10 if (open(FI, $input)) {
11 while (my $l = <FI>) {
14 if ($l =~ /^\s*\\begin_([a-z]+)/) {
18 elsif ($l =~ /^\s*\\(index|branch)\s/) {
19 # does not start with e.g. \begin_index, but ends with \end_index!!
23 elsif ($l =~ /^\s*\\end_([a-z]+)/) {
26 if ($stack[$depth-1] eq $expect) {
30 print "expected \\end_$stack[$depth-1], got \\end_$expect instead at $input:$line\n";
35 print "got \\end_$expect, but depth is already 0 at $input:$line\n";