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 (_isolate_last_space)


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_isolate_last_space), tp/Texinfo/XS/parsetexi/parser.c (isolate_last_space): do not set comment_at_end for brace commands.
Date: Sat, 10 Dec 2022 19:24:35 -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 f4199fbafb * tp/Texinfo/ParserNonXS.pm (_isolate_last_space), 
tp/Texinfo/XS/parsetexi/parser.c (isolate_last_space): do not set 
comment_at_end for brace commands.
f4199fbafb is described below

commit f4199fbafb1d870367cc82d8a5b39cbbe761b6b0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 11 01:24:14 2022 +0100

    * tp/Texinfo/ParserNonXS.pm (_isolate_last_space),
    tp/Texinfo/XS/parsetexi/parser.c (isolate_last_space): do not set
    comment_at_end for brace commands.
---
 ChangeLog                                |  6 ++++++
 tp/Texinfo/Convert/TexinfoMarkup.pm      |  2 ++
 tp/Texinfo/ParserNonXS.pm                |  9 ++++++--
 tp/Texinfo/XS/parsetexi/parser.c         |  7 +++++--
 tp/t/results/sectioning/empty_ref_arg.pl | 36 +++++++++++++++++++-------------
 5 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3d56eb10c8..b45c9bde33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,12 @@
        Use add_next instead of add_text to add space, and do not
        use 'w' formatter stack or call set_space_protection.
 
+2022-12-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_isolate_last_space),
+       tp/Texinfo/XS/parsetexi/parser.c (isolate_last_space): do not set
+       comment_at_end for brace commands.
+
 2022-12-10  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert_argument_and_end_line)
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 1795eaba12..8a1aff9740 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -568,6 +568,8 @@ sub _convert_argument_and_end_line($$)
 }
 
 # used in brace commands
+# NOTE not really needed now that comment_at_end are not generated
+# for brace commands.
 sub _convert_comment_at_end
 {
   my $self = shift;
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 8f036cab71..780346fa15 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2486,8 +2486,13 @@ sub _isolate_last_space
 
   return if (!$current->{'contents'});
 
-  # Store a final comment command in the 'info' hash.
-  if (scalar(@{$current->{'contents'}}) >= 1
+  # $current->{'type'} is always set, to line_arg, block_line_arg,
+  # brace_command_arg, bracketed or menu_entry_node
+
+  # Store a final comment command in the 'info' hash, except for brace
+  # commands
+  if (not ($current->{'type'} and $current->{'type'} eq 'brace_command_arg')
+      and scalar(@{$current->{'contents'}}) >= 1
       and $current->{'contents'}->[-1]->{'cmdname'}
       and ($current->{'contents'}->[-1]->{'cmdname'} eq 'c'
             or $current->{'contents'}->[-1]->{'cmdname'} eq 'comment')) {
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index b988994b28..f9fd09e6b1 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -761,8 +761,11 @@ isolate_last_space (ELEMENT *current)
   if (current->contents.number == 0)
     return;
 
-  if (last_contents_child(current)->cmd == CM_c
-      || last_contents_child(current)->cmd == CM_comment)
+  /* Store a final comment command in the 'info' hash, except for brace
+     commands */
+  if (current->type != ET_brace_command_arg
+      && (last_contents_child(current)->cmd == CM_c
+          || last_contents_child(current)->cmd == CM_comment))
     {
       add_info_element_oot (current, "comment_at_end",
                              pop_element_from_contents (current));
diff --git a/tp/t/results/sectioning/empty_ref_arg.pl 
b/tp/t/results/sectioning/empty_ref_arg.pl
index 6149b0969a..ac1544c25f 100644
--- a/tp/t/results/sectioning/empty_ref_arg.pl
+++ b/tp/t/results/sectioning/empty_ref_arg.pl
@@ -210,10 +210,12 @@ $result_trees{'empty_ref_arg'} = {
                     },
                     {
                       'cmdname' => ' '
-                    }
-                  ],
-                  'info' => {
-                    'comment_at_end' => {
+                    },
+                    {
+                      'text' => '
+'
+                    },
+                    {
                       'args' => [
                         {
                           'text' => ' ggg
@@ -228,9 +230,9 @@ $result_trees{'empty_ref_arg'} = {
 '
                         ]
                       }
-                    },
-                    'spaces_after_argument' => '
-',
+                    }
+                  ],
+                  'info' => {
                     'spaces_before_argument' => ' '
                   },
                   'type' => 'brace_command_arg'
@@ -252,10 +254,8 @@ $result_trees{'empty_ref_arg'} = {
 '
                         ]
                       }
-                    }
-                  ],
-                  'info' => {
-                    'comment_at_end' => {
+                    },
+                    {
                       'args' => [
                         {
                           'text' => '
@@ -270,7 +270,9 @@ $result_trees{'empty_ref_arg'} = {
 '
                         ]
                       }
-                    },
+                    }
+                  ],
+                  'info' => {
                     'spaces_before_argument' => ' '
                   },
                   'type' => 'brace_command_arg'
@@ -413,23 +415,29 @@ $result_errors{'empty_ref_arg'} = [
   },
   {
     'error_line' => 'warning: in @ref empty cross reference name after 
expansion `@c aaa
- @ \'
+ @ 
+@c ggg
+\'
 ',
     'file_name' => '',
     'line_nr' => 11,
     'macro' => '',
     'text' => 'in @ref empty cross reference name after expansion `@c aaa
- @ \'',
+ @ 
+@c ggg
+\'',
     'type' => 'warning'
   },
   {
     'error_line' => 'warning: in @ref empty cross reference title after 
expansion `@c fff
+@c
 \'
 ',
     'file_name' => '',
     'line_nr' => 11,
     'macro' => '',
     'text' => 'in @ref empty cross reference title after expansion `@c fff
+@c
 \'',
     'type' => 'warning'
   }



reply via email to

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