texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/ParserNonXS.pm (_next_text, _process


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_next_text, _process_remaining_on_line): simplify the information passed to determine the end of macro or value expansion.
Date: Fri, 06 Jan 2023 15:21:59 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 77300a256e * tp/Texinfo/ParserNonXS.pm (_next_text, 
_process_remaining_on_line): simplify the information passed to determine the 
end of macro or value expansion.
77300a256e is described below

commit 77300a256eed67fa670d57f465d3cb1156199c1a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jan 6 21:21:50 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_next_text, _process_remaining_on_line):
    simplify the information passed to determine the end of macro or value
    expansion.
---
 ChangeLog                 |  6 ++++++
 tp/TODO                   |  5 ++---
 tp/Texinfo/ParserNonXS.pm | 21 ++++++++-------------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e77da072af..c255fb2cef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-06  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_next_text, _process_remaining_on_line):
+       simplify the information passed to determine the end of macro or value
+       expansion.
+
 2023-01-06  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_prepare_input_from_text)
diff --git a/tp/TODO b/tp/TODO
index 7e97b81c6b..a1808cfeba 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -105,9 +105,8 @@ the context command stack.
  @end defun
 
 
-Recursive expansion of @value may lead to an infinite loop.  Using
-a stack as for macros seems to be the best, and using sourcemark
-for the end of the expansion. (done in perl parser).
+Recursive expansion of @value may lead to an infinite loop.  Fixed in
+pure perl parser, still to be done in XS parser.
  https://bugzilla.redhat.com/show_bug.cgi?id=744878
 
 
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 96237a05fe..491283187d 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2177,17 +2177,16 @@ sub _next_text($$)
     my $input = $self->{'input'}->[0];
     if (@{$input->{'pending'}}) {
       my $new_text_and_info = shift @{$input->{'pending'}};
-      if ($new_text_and_info->[1] and $new_text_and_info->[1]->{'sourcemark'}) 
{
-        my $sourcemark = $new_text_and_info->[1]->{'sourcemark'};
-        delete $new_text_and_info->[1]->{'sourcemark'};
-        if ($sourcemark->{'type'} eq 'macro'
-            and $sourcemark->{'status'} eq 'end') {
+      if ($new_text_and_info->[1]
+          and $new_text_and_info->[1]->{'expansion_end'}) {
+        my $expansion_end = $new_text_and_info->[1]->{'expansion_end'};
+        delete $new_text_and_info->[1]->{'expansion_end'};
+        if ($expansion_end->{'source'} eq 'macro') {
           my $top_macro = shift @{$self->{'macro_stack'}};
           print STDERR "SHIFT MACRO_STACK(@{$self->{'macro_stack'}}):"
             ." $top_macro->{'args'}->[0]->{'text'}\n"
               if ($self->{'DEBUG'});
-        } elsif ($sourcemark->{'type'} eq 'value'
-                 and $sourcemark->{'status'} eq 'end') {
+        } elsif ($expansion_end->{'source'} eq 'value') {
           my $top_value = shift @{$self->{'value_stack'}};
           print STDERR "SHIFT VALUE_STACK(@{$self->{'value_stack'}}):"
             . "$top_value\n"
@@ -4420,9 +4419,7 @@ sub _process_remaining_on_line($$$$)
       my $new_lines = _complete_line_nr($expanded_lines,
                        $source_info->{'line_nr'}, $source_info->{'file_name'},
                        $expanded_macro->{'args'}->[0]->{'text'}, 1);
-      $source_info->{'sourcemark'} = {'type' => 'macro',
-                      'info' => $expanded_macro->{'args'}->[0]->{'text'},
-                      'status' => 'end'};
+      $source_info->{'expansion_end'} = {'source' => 'macro'};
       # first put the line that was interrupted by the macro call
       # on the input pending text with information stack
       if (! scalar(@{$self->{'input'}})) {
@@ -4463,9 +4460,7 @@ sub _process_remaining_on_line($$$$)
             push @{$self->{'input'}}, {'pending' => []};
           }
           my $pending_source_info = { %$source_info };
-          $pending_source_info->{'sourcemark'} = {'type' => 'value',
-                                                  'info' => $value,
-                                                  'status' => 'end'};
+          $pending_source_info->{'expansion_end'} = {'source' => 'value'};
           unshift @{$self->{'input'}->[0]->{'pending'}},
                                  [$expanded_line, $pending_source_info];
           $line = $self->{'values'}->{$value};



reply via email to

[Prev in Thread] Current Thread [Next in Thread]