[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo Parser.pm
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo Parser.pm |
Date: |
Sat, 20 Aug 2011 21:02:26 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/08/20 21:02:26
Modified files:
tp/Texinfo : Parser.pm
Log message:
Cleanup the context_stack of the parser before exiting _parse_texi.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.279&r2=1.280
Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -b -r1.279 -r1.280
--- Parser.pm 20 Aug 2011 14:38:46 -0000 1.279
+++ Parser.pm 20 Aug 2011 21:02:26 -0000 1.280
@@ -30,6 +30,10 @@
# We need the unicode stuff.
use 5.006;
use strict;
+
+# debug
+#use Carp qw(cluck);
+
use Data::Dumper;
# to detect if an encoding may be used to open the files
@@ -777,7 +781,8 @@
$self = parser() if (!defined($self));
$self->{'input'} = [{'pending' => $lines_array}];
- return $self->_parse_texi();
+ my $tree = $self->_parse_texi();
+ return $tree;
}
# parse a texi file
@@ -821,6 +826,7 @@
$self->{'info'}->{'input_file_name'} = $file_name;
my $tree = $self->_parse_texi($root);
+ # Find 'text_root', which contains everything before first node/section.
# if there are elements, 'text_root' is the first content, otherwise it
# is the root.
my $text_root;
@@ -870,7 +876,8 @@
$self = parser() if (!defined($self));
$self->{'input'} = [{'pending' => $lines_array}];
- return $self->_parse_texi({'contents' => [], 'type' => 'root_line'});
+ my $tree = $self->_parse_texi({'contents' => [], 'type' => 'root_line'});
+ return $tree;
}
# return the errors and warnings
@@ -2936,7 +2943,8 @@
$current = $current->{'parent'};
print STDERR "$indent"._print_current($current);
}
- die "BUG: didn't go up (infinite loop)\n"
+ #cluck "Problem with opened line command $self->{'context_stack'}->[-1]";
+ die "BUG: did not go up (infinite loop)\n"
}
my $other_included_file = 0;
@@ -4491,6 +4499,16 @@
$self->line_error (sprintf($self->__("Expected address@hidden %s"),
$end_conditional), $line_nr);
}
$current = _close_commands($self, $current, $line_nr);
+
+ if (@{$self->{'context_stack'}} != 1) {
+ # This happens in 2 cases in the tests:
+ #Â @verb not closed on misc commands line
+ # def line escaped with @ ending the file
+ if ($self->{'DEBUG'}) {
+ print STDERR "CONTEXT_STACK no empty end _parse_texi: ".join('|',
@{$self->{'context_stack'}})."\n";
+ }
+ @{$self->{'context_stack'}} = ($self->{'context'});
+ }
return $root;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/Texinfo Parser.pm,
Patrice Dumas <=