diff options
Diffstat (limited to 'bin/emitpkgtree')
-rwxr-xr-x | bin/emitpkgtree | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/bin/emitpkgtree b/bin/emitpkgtree deleted file mode 100755 index ca12c59..0000000 --- a/bin/emitpkgtree +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl - -use warnings; -use strict; - -my $PROG = 'flatlntree'; - -sub parsetree -{ - my($name) = @_; - my($txt, $ln, @tree) = (q{}, $., $name); - while(<STDIN>){ - if(/^BEGNODE (\S+)$/){ - push @tree, $txt if($txt); - push @tree, parsetree($1); - $txt = q{}; - }elsif(/^ENDNODE (\S+)$/){ - if($1 ne $name){ - print STDERR "$PROG: wrong ENDNODE:" - . qq{ '$1' at line $.} - . qq{ (in '$name' started at line $ln)\n}; - exit 101; - }else{ - last; - } - }else{ - $txt .= $_; - } - } - - push @tree, $txt if($txt); - return \@tree; -} - -sub flatten -{ - my($tree) = @_; - if(ref $tree){ - # skip name - return join q{}, map { flatten($tree->[$_]) } 1 .. $#$tree; - }else{ - return $tree; - } -} - -sub main -{ - my $top = parsetree('TOP'); - @$top = grep { ref } @$top; # only keep sub-nodes - for my $n (@$top){ - my $name = $n->[0]; - print ">>> $name\n"; - print flatten($n); - } - return 0; -} - -exit main(); |