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 (_expand_macro_argume


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_expand_macro_arguments), tp/Texinfo/XS/parsetexi/macro.c (expand_macro_arguments): simplify XS parser code. More consistent code.
Date: Thu, 13 Jul 2023 19:02:23 -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 3f4d2a5daf * tp/Texinfo/ParserNonXS.pm (_expand_macro_arguments), 
tp/Texinfo/XS/parsetexi/macro.c (expand_macro_arguments): simplify XS parser 
code.  More consistent code.
3f4d2a5daf is described below

commit 3f4d2a5daf9bcde7d625eaa427e2c47eba3291ee
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jul 14 01:02:13 2023 +0200

    * tp/Texinfo/ParserNonXS.pm (_expand_macro_arguments),
    tp/Texinfo/XS/parsetexi/macro.c (expand_macro_arguments): simplify XS
    parser code.  More consistent code.
---
 ChangeLog                       |  6 +++++
 tp/Texinfo/ParserNonXS.pm       |  4 ++--
 tp/Texinfo/XS/parsetexi/macro.c | 50 ++++++++++++++++++-----------------------
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f3cccbb465..c1d74ec8fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-13  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_expand_macro_arguments),
+       tp/Texinfo/XS/parsetexi/macro.c (expand_macro_arguments): simplify XS
+       parser code.  More consistent code.
+
 2023-07-13  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_close_current, _expand_macro_arguments)
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 9dab33af60..f364259945 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2546,7 +2546,7 @@ sub _expand_macro_arguments($$$$$)
         }
       } elsif ($separator eq ',') {
         if ($braces_level > 1) {
-          $argument_content->{'text'} .= ',';
+          $argument_content->{'text'} .= $separator;
         } else {
           if (scalar(@{$current->{'args'}}) < $args_total) {
             _remove_empty_content($self, $argument);
@@ -2571,7 +2571,7 @@ sub _expand_macro_arguments($$$$$)
                                      "macro `%s' called with too many args"),
                                         $name), $source_info);
             }
-            $argument_content->{'text'} .= ',';
+            $argument_content->{'text'} .= $separator;
           }
         }
       } elsif ($separator eq '}') {
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 062e90a5a4..03f14dd4c5 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -352,30 +352,25 @@ expand_macro_arguments (ELEMENT *macro, char 
**line_inout, enum command_id cmd,
         case '}':
           braces_level--;
           if (braces_level > 0)
-            {
-              text_append_n (arg, sep, 1);
-              pline = sep + 1;
-              break;
-            }
-
-          /* Fall through to add argument. */
+            text_append_n (arg, sep, 1);
+          else
+            /* end of arguments */
+            remove_empty_content (argument);
+          pline = sep + 1;
+          break;
         case ',':
+          pline = sep + 1;
           if (braces_level > 1)
+            text_append_n (arg, sep, 1);
+          else
             {
-              text_append_n (arg, sep, 1);
-              pline = sep + 1;
-              break;
-            }
-
-          if (*sep == '}' || current->args.number < args_total)
-            {
-              pline = sep + 1;
-
-              remove_empty_content (argument);
-              if (*sep == ',')
-                /* new argument */
+              if (current->args.number < args_total)
                 {
                   char *p = pline;
+
+                  remove_empty_content (argument);
+
+                  /* new argument */
                   argument = new_element (ET_brace_command_arg);
                   argument_content = new_element (ET_NONE);
                   add_to_element_args (current, argument);
@@ -392,15 +387,14 @@ expand_macro_arguments (ELEMENT *macro, char 
**line_inout, enum command_id cmd,
                     }
                   debug ("MACRO NEW ARG");
                 }
-            }
-          else
-            /* too many args */
-            {
-              if (args_total != 1)
-                line_error ("macro `%s' called with too many args",
-                            command_name(cmd));
-              text_append_n (arg, ",", 1);
-              pline = sep + 1;
+              else
+                /* too many args */
+                {
+                  if (args_total != 1)
+                    line_error ("macro `%s' called with too many args",
+                                command_name(cmd));
+                  text_append_n (arg, sep, 1);
+                }
             }
           break;
         }



reply via email to

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