texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (process_remai


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): check that a nested @macro is followed by space or at end of string.
Date: Wed, 28 Dec 2022 07:13:57 -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 f025dd7198 * tp/Texinfo/XS/parsetexi/parser.c 
(process_remaining_on_line): check that a nested @macro is followed by space or 
at end of string.
f025dd7198 is described below

commit f025dd7198a861dde532873c035144b8231ed72f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 28 13:13:45 2022 +0100

    * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): check
    that a nested @macro is followed by space or at end of string.
    
    * tp/t/60macro.t, tp/Makefile.tres: add
    macro_imbricated_with_beginning_command_name test with an @-command
    beginning with @macro imbricated in @macro.
---
 ChangeLog                                          |   9 ++
 tp/Makefile.tres                                   |   1 +
 tp/TODO                                            |   7 --
 tp/Texinfo/XS/parsetexi/parser.c                   |   2 +
 tp/t/60macro.t                                     |   9 ++
 ...macro_imbricated_with_beginning_command_name.pl | 115 +++++++++++++++++++++
 6 files changed, 136 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ab27898aa3..edc7c2c4a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-12-28  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): check
+       that a nested @macro is followed by space or at end of string.
+
+       * tp/t/60macro.t, tp/Makefile.tres: add
+       macro_imbricated_with_beginning_command_name test with an @-command
+       beginning with @macro imbricated in @macro.
+
 2022-12-28  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.tex, NEWS: Turn microtype off by default, for speed.
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index c8cc331abe..0f4e495c6c 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -1215,6 +1215,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/macro_expansion.pl \
   t/results/macro/macro_for_end.pl \
   t/results/macro/macro_for_ignored_line_command.pl \
+  t/results/macro/macro_imbricated_with_beginning_command_name.pl \
   t/results/macro/macro_in_accent.pl \
   t/results/macro/macro_in_brace_command.pl \
   t/results/macro/macro_in_end_argument.pl \
diff --git a/tp/TODO b/tp/TODO
index a92f06b147..921de87825 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,13 +13,6 @@ Before next release
 Bugs
 ====
 
-Test for nested @macro
-@macrototo
-and check that with XS this is as if it was @macro
-
-test with nested ignore with something a comment, and with
-@-commands before a comment
-
 HTML API
 ========
 
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 84263597bd..14b2f2d20b 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1139,6 +1139,8 @@ process_remaining_on_line (ELEMENT **current_inout, char 
**line_inout)
               p += strlen ("@rmacro");
               cmd = CM_rmacro;
             }
+          if (*p && !strchr (whitespace_chars, *p))
+            cmd = 0;
         }
       else if (current->cmd == CM_ignore)
         {
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index 5cae474483..b40d035342 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -464,6 +464,15 @@ a, macro2
 
 @macrothree{@macrooneone{}text for macro2}
 '],
+['macro_imbricated_with_beginning_command_name',
+'@macro foo
+
+@macrototo
+in macrototo
+@end macro
+
+@end macro
+'],
 ['macro_in_brace_command',
 '@macro foo
 foo-expansion
diff --git a/tp/t/results/macro/macro_imbricated_with_beginning_command_name.pl 
b/tp/t/results/macro/macro_imbricated_with_beginning_command_name.pl
new file mode 100644
index 0000000000..d0f6d1e7a5
--- /dev/null
+++ b/tp/t/results/macro/macro_imbricated_with_beginning_command_name.pl
@@ -0,0 +1,115 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'macro_imbricated_with_beginning_command_name'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'foo',
+              'type' => 'macro_name'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '
+',
+              'type' => 'raw'
+            },
+            {
+              'text' => '@macrototo
+',
+              'type' => 'raw'
+            },
+            {
+              'text' => 'in macrototo
+',
+              'type' => 'raw'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => '
+'
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => ' '
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' foo
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'macro_imbricated_with_beginning_command_name'} = '@macro foo
+
+@macrototo
+in macrototo
+@end macro
+
+';
+
+
+$result_texts{'macro_imbricated_with_beginning_command_name'} = '
+';
+
+$result_errors{'macro_imbricated_with_beginning_command_name'} = [
+  {
+    'error_line' => 'unmatched `@end macro\'
+',
+    'file_name' => '',
+    'line_nr' => 7,
+    'macro' => '',
+    'text' => 'unmatched `@end macro\'',
+    'type' => 'error'
+  }
+];
+
+
+$result_floats{'macro_imbricated_with_beginning_command_name'} = {};
+
+
+1;



reply via email to

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