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 (_handle_macro) (_pro


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_handle_macro) (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/macro.c (handle_macro): rename arguments_container variable as macro_call_element for consistency.
Date: Mon, 27 Mar 2023 16:50:31 -0400

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 ca4f7385d8 * tp/Texinfo/ParserNonXS.pm (_handle_macro) 
(_process_remaining_on_line), tp/Texinfo/XS/parsetexi/macro.c (handle_macro): 
rename arguments_container variable as macro_call_element for consistency.
ca4f7385d8 is described below

commit ca4f7385d824ce10c089c2e79513d678b46892cc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Mar 27 22:50:26 2023 +0200

    * tp/Texinfo/ParserNonXS.pm (_handle_macro)
    (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/macro.c
    (handle_macro): rename arguments_container variable as
    macro_call_element for consistency.
---
 ChangeLog                       |  7 +++++
 tp/Texinfo/ParserNonXS.pm       | 58 ++++++++++++++++++++---------------------
 tp/Texinfo/XS/parsetexi/macro.c | 28 ++++++++++----------
 3 files changed, 50 insertions(+), 43 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 899f1ee047..71384b022d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-03-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_handle_macro)
+       (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/macro.c
+       (handle_macro): rename arguments_container variable as
+       macro_call_element for consistency.
+
 2023-03-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 498a81d7cd..eec9a29f8b 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4769,18 +4769,18 @@ sub _handle_macro($$$$$)
 
   my $expanded_macro = $self->{'macros'}->{$command}->{'element'};
   my $args_number = scalar(@{$expanded_macro->{'args'}}) -1;
-  my $arguments_container = {'type' => $expanded_macro->{'cmdname'}.'_call',
-                             'extra' => {'name' => $command},
-                             'args' => []};
+  my $macro_call_element = {'type' => $expanded_macro->{'cmdname'}.'_call',
+                            'extra' => {'name' => $command},
+                            'args' => []};
   if ($expanded_macro->{'cmdname'} ne 'linemacro') {
     if ($line =~ s/^\s*{(\s*)//) { # } macro with args
       if ($1 ne '') {
-        $arguments_container->{'info'}
+        $macro_call_element->{'info'}
             = {'spaces_before_argument' => {'text' => $1}};
       }
       ($line, $source_info)
        = _expand_macro_arguments($self, $expanded_macro, $line, $source_info,
-                                 $arguments_container);
+                                 $macro_call_element);
     } elsif (($args_number >= 2) or ($args_number <1)) {
     # as agreed on the bug-texinfo mailing list, no warn when zero
     # arg and not called with {}.
@@ -4790,8 +4790,8 @@ sub _handle_macro($$$$$)
          if ($args_number >= 2);
     } else {
       my $arg_elt = {'type' => 'line_arg',
-                     'parent' => $arguments_container};
-      push @{$arguments_container->{'args'}}, $arg_elt;
+                     'parent' => $macro_call_element};
+      push @{$macro_call_element->{'args'}}, $arg_elt;
       while (1) {
         if ($line eq '') {
           ($line, $source_info) = _new_line($self, $arg_elt);
@@ -4805,7 +4805,7 @@ sub _handle_macro($$$$$)
                                   'text' => $1,
                                   'parent' => $arg_elt,
                                   'extra' => {'spaces_associated_command'
-                                                => $arguments_container}};
+                                                => $macro_call_element}};
             push @{$arg_elt->{'contents'}}, $internal_space;
           } else {
             if ($line !~ /\n/) {
@@ -4851,12 +4851,12 @@ sub _handle_macro($$$$$)
     if ($self->{'DEBUG'});
 
   if ($expanded_macro->{'cmdname'} eq 'linemacro') {
-    return ($arguments_container, $line, $source_info);
+    return ($macro_call_element, $line, $source_info);
   }
 
   my $expanded = _expand_macro_body($self,
                             $self->{'macros'}->{$command},
-                            $arguments_container->{'args'}, $source_info);
+                            $macro_call_element->{'args'}, $source_info);
   print STDERR "MACROBODY: $expanded".'||||||'."\n"
     if ($self->{'DEBUG'});
 
@@ -4871,16 +4871,16 @@ sub _handle_macro($$$$$)
                    $expanded_macro->{'args'}->[0]->{'text'});
   my $macro_source_mark = {'sourcemark_type' => 'macro_expansion',
                            'status' => 'start'};
-  delete $arguments_container->{'args'}
-     if (scalar(@{$arguments_container->{'args'}}) == 0);
-  $macro_source_mark->{'element'} = $arguments_container;
+  delete $macro_call_element->{'args'}
+     if (scalar(@{$macro_call_element->{'args'}}) == 0);
+  $macro_source_mark->{'element'} = $macro_call_element;
   _register_source_mark($self, $current, $macro_source_mark);
   $self->{'input'}->[0]->{'input_source_mark'} = $macro_source_mark;
   # not really important as line is ignored by the caller if there
   # was no macro expansion error
   $line = '';
  #funexit:
-  return ($arguments_container, $line, $source_info);
+  return ($macro_call_element, $line, $source_info);
 }
 
 # to have similar code with the XS parser, the only returned information
@@ -6514,7 +6514,7 @@ sub _process_remaining_on_line($$$$)
     .join(', ',map {!defined($_) ? 'UNDEF' : "'$_'"} @line_parsing)."\n"
        if ($self->{'DEBUG'} and $self->{'DEBUG'} > 3);
 
-  my $arguments_container;
+  my $macro_call_element;
   my $command;
   my $from_alias;
   if ($single_letter_command) {
@@ -6534,22 +6534,22 @@ sub _process_remaining_on_line($$$$)
       my $arg_line = $line;
       substr($arg_line, 0, $at_command_length) = '';
 
-      ($arguments_container, $arg_line, $source_info)
+      ($macro_call_element, $arg_line, $source_info)
         = _handle_macro($self, $current, $arg_line, $source_info, $command);
-      if ($arguments_container) {
+      if ($macro_call_element) {
         if ($from_alias) {
-          $arguments_container->{'info'} = {}
-             if (!$arguments_container->{'info'});
-          $arguments_container->{'info'}->{'alias_of'} = $from_alias;
+          $macro_call_element->{'info'} = {}
+             if (!$macro_call_element->{'info'});
+          $macro_call_element->{'info'}->{'alias_of'} = $from_alias;
         }
       }
-      if ($arguments_container
-          and $arguments_container->{'type'} eq 'linemacro_call') {
+      if ($macro_call_element
+          and $macro_call_element->{'type'} eq 'linemacro_call') {
         # do nothing, the linemacro defined command call is done at the
         # end of the line after parsing the line similarly as for @def*
       } else {
         $line = $arg_line;
-        if ($arguments_container) {
+        if ($macro_call_element) {
           # directly get the following input (macro expansion text) instead
           # of going through the next call of process_remaining_on_line and
           # the processing of empty text.  No difference in output, more
@@ -6652,7 +6652,7 @@ sub _process_remaining_on_line($$$$)
       # @txiinternalvalue is invalid unless accept_internalvalue is set
       and !($command eq 'txiinternalvalue'
             and $self->{'accept_internalvalue'})
-      and !$arguments_container) {
+      and !$macro_call_element) {
     $self->_line_error(sprintf(__("unknown command `%s'"),
                                   $command), $source_info);
     substr($line, 0, $at_command_length) = '';
@@ -6824,19 +6824,19 @@ sub _process_remaining_on_line($$$$)
       }
       return ($current, $line, $source_info, $retval);
       # goto funexit;  # used in XS code
-    } elsif ($arguments_container) {
+    } elsif ($macro_call_element) {
       # linemacro defined command call
-      push @{$current->{'contents'}}, $arguments_container;
-      $arguments_container->{'parent'} = $current;
+      push @{$current->{'contents'}}, $macro_call_element;
+      $macro_call_element->{'parent'} = $current;
       $self->_push_context('ct_linecommand', $command);
-      $current = $arguments_container;
+      $current = $macro_call_element;
       $current->{'args'} = [];
       my $line_arg = { 'type' => 'line_arg',
                         'parent' => $current };
       push @{$current->{'args'}}, $line_arg;
       $current = $line_arg;
       $line = _start_empty_line_after_command($line, $current,
-                                              $arguments_container);
+                                              $macro_call_element);
       return ($current, $line, $source_info, $retval);
       # goto funexit;  # used in XS code
     }
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 3cb30c2b8f..0c4fded4be 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -562,7 +562,7 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
   char *expanded_macro_text;
   int args_number;
   SOURCE_MARK *macro_source_mark;
-  ELEMENT *arguments_container = new_element (ET_NONE);
+  ELEMENT *macro_call_element = new_element (ET_NONE);
   int error = 0;
 
   line = *line_inout;
@@ -574,13 +574,13 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
   macro = macro_record->element;
 
   if (macro->cmd == CM_macro)
-    arguments_container->type = ET_macro_call;
+    macro_call_element->type = ET_macro_call;
   else if (macro->cmd == CM_rmacro)
-    arguments_container->type = ET_rmacro_call;
+    macro_call_element->type = ET_rmacro_call;
   else if (macro->cmd == CM_linemacro)
-    arguments_container->type = ET_linemacro_call;
+    macro_call_element->type = ET_linemacro_call;
 
-  add_extra_string_dup (arguments_container, "name", command_name(cmd));
+  add_extra_string_dup (macro_call_element, "name", command_name(cmd));
 
   if (macro->cmd != CM_linemacro)
     {
@@ -597,10 +597,10 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
             {
               ELEMENT *spaces_element = new_element (ET_NONE);
               text_append_n (&spaces_element->text, p, line - p);
-              add_info_element_oot (arguments_container, 
"spaces_before_argument",
+              add_info_element_oot (macro_call_element, 
"spaces_before_argument",
                                     spaces_element);
             }
-          expand_macro_arguments (macro, &line, cmd, arguments_container);
+          expand_macro_arguments (macro, &line, cmd, macro_call_element);
         }
       /* Warning depending on the number of arguments this macro
          is supposed to take. */
@@ -615,7 +615,7 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
       else
         {
           ELEMENT *arg_elt = new_element (ET_line_arg);
-          add_to_element_args (arguments_container, arg_elt);
+          add_to_element_args (macro_call_element, arg_elt);
 
           while (1)
             {
@@ -645,7 +645,7 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
                                          leading_spaces_nr);
                           add_extra_element (internal_space,
                                              "spaces_associated_command",
-                                             arguments_container);
+                                             macro_call_element);
                           add_to_element_contents (arg_elt, internal_space);
 
                           line += leading_spaces_nr;
@@ -701,7 +701,7 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
   if (macro->cmd == CM_linemacro)
     goto funexit;
 
-  expand_macro_body (macro_record, arguments_container, &expanded);
+  expand_macro_body (macro_record, macro_call_element, &expanded);
   debug ("MACROBODY: %s||||||", expanded.text);
 
   if (expanded.end > 0 && expanded.text[expanded.end - 1] == '\n')
@@ -709,7 +709,7 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
 
   macro_source_mark = new_source_mark (SM_type_macro_expansion);
   macro_source_mark->status = SM_status_start;
-  macro_source_mark->element = arguments_container;
+  macro_source_mark->element = macro_call_element;
   register_source_mark (current, macro_source_mark);
 
   /* Put expansion in front of the current line. */
@@ -730,11 +730,11 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
 
   if (error)
     {
-      destroy_element_and_children (arguments_container);
-      arguments_container = 0;
+      destroy_element_and_children (macro_call_element);
+      macro_call_element = 0;
     }
   *line_inout = line;
-  return arguments_container;
+  return macro_call_element;
 }
 
 



reply via email to

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