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


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line): initialize 'items_count' in @itemize or @enumerate to be more similar to XS parser, and cleaner.
Date: Wed, 14 Sep 2022 17:57: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 1f77bf1b94 * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line): 
initialize 'items_count' in @itemize or @enumerate to be more similar to XS 
parser, and cleaner.
1f77bf1b94 is described below

commit 1f77bf1b94f23add54db9a219481c3025f9c7e76
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 14 23:57:21 2022 +0200

    * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line): initialize
    'items_count' in @itemize or @enumerate to be more similar to
    XS parser, and cleaner.
    
    * tp/Texinfo/XS/parsetexi/handle_commands.c (handle_block_command):
    avoid a useless block, remove useless comments.
---
 ChangeLog                                 |  9 +++++++
 tp/Texinfo/ParserNonXS.pm                 |  5 ++++
 tp/Texinfo/XS/parsetexi/handle_commands.c | 42 +++++++++++++------------------
 3 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index faa6d2d9f2..59649590e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-09-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line): initialize
+       'items_count' in @itemize or @enumerate to be more similar to
+       XS parser, and cleaner.
+
+       * tp/Texinfo/XS/parsetexi/handle_commands.c (handle_block_command):
+       avoid a useless block, remove useless comments.
+
 2022-09-14  Patrice Dumas  <pertusus@free.fr>
 
        Rename empty_* types, removing empty and adding if needed
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index adfdf03242..98f8ef8c31 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -5069,6 +5069,11 @@ sub _process_remaining_on_line($$$$)
             }
           }
         }
+        # cleaner, and more similar to XS parser, but not required, would have
+        # been initialized automatically.
+        $current->{'items_count'} = 0
+           if ($item_container_commands{$command});
+
         $current->{'args'} = [ {
            'type' => 'block_line_arg',
            'contents' => [],
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c 
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 7da6848840..1f85f2f122 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -841,6 +841,7 @@ handle_block_command (ELEMENT *current, char **line_inout,
   else
     {
       ELEMENT *block = 0;
+      ELEMENT *bla;   /* block line arg element */
       if (flags & CF_menu
           && (current->type == ET_menu_comment
               || current->type == ET_menu_entry_description))
@@ -932,34 +933,27 @@ handle_block_command (ELEMENT *current, char **line_inout,
 
       if (cmd == CM_itemize || cmd == CM_enumerate)
         counter_push (&count_items, current, 0);
-      /* Note that no equivalent thing is done in the Perl code, because
-         'item_count' is assumed to start at 0. */
 
-        {
-          ELEMENT *bla = new_element (ET_block_line_arg);
-          add_to_element_args (current, bla);
+      bla = new_element (ET_block_line_arg);
+      add_to_element_args (current, bla);
 
-          if (command_data (current->cmd).data > 1)
-            {
-              counter_push (&count_remaining_args,
-                            current,
-                            command_data (current->cmd).data - 1);
-            }
-          else if (command_data (current->cmd).data == BLOCK_variadic)
-            {
-              /* Unlimited args */
-              counter_push (&count_remaining_args, current,
-                            COUNTER_VARIADIC);
-            }
-
-          current = bla;
-          if (!(command_data(cmd).flags & CF_def))
-            push_context (ct_line, cmd);
+      if (command_data (current->cmd).data > 1)
+        {
+          counter_push (&count_remaining_args,
+                        current,
+                        command_data (current->cmd).data - 1);
+        }
+      else if (command_data (current->cmd).data == BLOCK_variadic)
+        {
+          /* Unlimited args */
+          counter_push (&count_remaining_args, current,
+                        COUNTER_VARIADIC);
+        }
 
-          /* Note that an ET_ignorable_spaces_after_command gets reparented
-             in the contents in 'end_line'. */
+      current = bla;
+      if (!(command_data(cmd).flags & CF_def))
+        push_context (ct_line, cmd);
 
-        }
       block->source_info = current_source_info;
       register_global_command (block);
       start_empty_line_after_command (current, &line, block);



reply via email to

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