[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: |
Wed, 23 Feb 2011 00:29:12 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/02/23 00:29:12
Modified files:
tp/Texinfo : Parser.pm
Log message:
Setup a macro call stack.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.205&r2=1.206
Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -b -r1.205 -r1.206
--- Parser.pm 21 Feb 2011 22:32:21 -0000 1.205
+++ Parser.pm 23 Feb 2011 00:29:12 -0000 1.206
@@ -222,6 +222,8 @@
# this is the initial context. It is put at the bottom of the
# 'context_stack'
'context' => '_root',
+ #Â the stack of the macros being expanded
+ 'macro_stack' => [''],
# these are the user-added indices. May be an array reference on names
# or an hash reference in the same format than %index_names below
'indices' => [],
@@ -1376,6 +1378,12 @@
my $current = $self->{'input'}->[0];
if (@{$current->{'pending'}}) {
my $new_text = shift @{$current->{'pending'}};
+ if ($new_text->[1] and $new_text->[1]->{'end_macro'}) {
+ delete $new_text->[1]->{'end_macro'};
+ my $top_macro = pop @{$self->{'macro_stack'}};
+ print STDERR "POP MACRO_STACK(@{$self->{'macro_stack'}}):
$top_macro->{'args'}->[0]->{'text'}\n"
+ if ($self->{'DEBUG'});
+ }
return ($new_text->[0], $new_text->[1]);
} elsif ($current->{'fh'}) {
my $fh = $current->{'fh'};
@@ -2816,7 +2824,12 @@
print STDERR "MACROBODY: $expanded".'||||||'."\n"
if ($self->{'DEBUG'});
# empty result. It is ignored here.
- next if ($expanded eq '');
+ if ($expanded eq '') {
+ next;
+ }
+ push @{$self->{'macro_stack'}}, $expanded_macro;
+ print STDERR "PUSH MACRO_STACK:
$expanded_macro->{'args'}->[0]->{'text'}\n"
+ if ($self->{'DEBUG'});
my $expanded_lines = _text_to_lines($expanded);
chomp ($expanded_lines->[-1]);
pop @$expanded_lines if ($expanded_lines->[-1] eq '');
@@ -2826,6 +2839,7 @@
my $new_lines = _complete_line_nr($expanded_lines,
$line_nr->{'line_nr'}, $line_nr->{'file_name'},
$expanded_macro->{'args'}->[0]->{'text'}, 1);
+ $line_nr->{'end_macro'} = 1;
unshift @{$self->{'input'}->[0]->{'pending'}}, [$line, $line_nr];
my $new_text = shift @$new_lines;
($line, $line_nr) = ($new_text->[0], $new_text->[1]);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/Texinfo Parser.pm,
Patrice Dumas <=