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 (_end_line): no empty


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line): no empty content in 'bracketed_multitable_prototype'.
Date: Sun, 04 Sep 2022 17:48:52 -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 252ece4484 * tp/Texinfo/ParserNonXS.pm (_end_line): no empty content 
in 'bracketed_multitable_prototype'.
252ece4484 is described below

commit 252ece448465f526d933118673a0ea48abe7b218
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 4 23:46:09 2022 +0200

    * tp/Texinfo/ParserNonXS.pm (_end_line): no empty content in
    'bracketed_multitable_prototype'.
    
    * tp/Texinfo/ParserNonXS.pm: make clear that empty_spaces_before_argument
    is a transient internal type that should be replaced by
    extra spaces_before_argument.
---
 ChangeLog                 |  9 ++++++++
 tp/TODO                   |  2 +-
 tp/Texinfo/ParserNonXS.pm | 55 +++++++++++++++++++++++++++++++----------------
 3 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 71f7ee045a..d55d2d6468 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-09-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_end_line): no empty content in
+       'bracketed_multitable_prototype'.
+
+       * tp/Texinfo/ParserNonXS.pm: make clear that 
empty_spaces_before_argument
+       is a transient internal type that should be replaced by
+       extra spaces_before_argument.
+
 2022-09-04  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.texi (Generating EPUB): Edit.
diff --git a/tp/TODO b/tp/TODO
index 5762e70c7b..b0e2a0a816 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -50,7 +50,7 @@ Tree documentation in ParserNonXS.pm
 replaced, elided, elided_block types.
 
 'extra'->'file' in replaced @include.
-extra->'comment_at_end' and extra->'spaces_after_argument'
+extra->'comment_at_end'
 likely in many line commands
 
 Other
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index bc334fc7c0..074b9a2a88 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2971,6 +2971,7 @@ sub _end_line($$$)
             and $current->{'parent'}->{'type'} eq 'def_line') {
     my ($error) = $self->_pop_context(['ct_def'], $source_info, $current);
     die if ($error);
+    #_abort_empty_line($self, $current);
     my $def_command = $current->{'parent'}->{'extra'}->{'def_command'};
     my $arguments = _parse_def($self, $def_command, $current);
     if (scalar(@$arguments)) {
@@ -3051,8 +3052,14 @@ sub _end_line($$$)
       my @prototype_row;
       foreach my $content (@{$current->{'contents'}}) {
         if ($content->{'type'} and $content->{'type'} eq 'bracketed') {
-          push @prototype_row, { 'contents' => $content->{'contents'},
-                                 'type' => 'bracketed_multitable_prototype'};
+          my $bracketed_prototype
+            = { 'type' => 'bracketed_multitable_prototype' };
+          if ($content->{'contents'}
+              and scalar(@{$content->{'contents'}}) > 0) {
+            # avoid empty content to match with XS parser.
+            $bracketed_prototype->{'contents'} = $content->{'contents'};
+          }
+          push @prototype_row, $bracketed_prototype;
         } elsif ($content->{'text'}) {
           # TODO: this should be a warning or an error - all prototypes
           # on a @multitable line should be in braces, as documented in the
@@ -5336,6 +5343,8 @@ sub _parse_texi($$$)
               }
               $line =~ s/([^\S\f\n]*)//;
               $current->{'type'} = 'brace_command_context';
+              # empty_spaces_before_argument is a transient internal type,
+              # which should end up in extra spaces_before_argument.
               push @{$current->{'contents'}}, {
                             'type' => 'empty_spaces_before_argument',
                             'text' => $1,
@@ -5344,9 +5353,13 @@ sub _parse_texi($$$)
                           };
             } else {
               $current->{'type'} = 'brace_command_arg';
+              # only put spaces in spaces_before_argument if the @-command
+              # has an explicit positive number of arguments.
               if ($brace_commands{$command}
                   and $brace_commands{$command} =~ /^\d$/
                   and $brace_commands{$command} > 0) {
+                # empty_spaces_before_argument is a transient internal type,
+                # which should end up in extra spaces_before_argument.
                 push @{$current->{'contents'}}, {
                             'type' => 'empty_spaces_before_argument',
                             'text' => '',
@@ -5374,6 +5387,8 @@ sub _parse_texi($$$)
             $current->{'source_info'} = $source_info
               if ($current->{'parent'}->{'parent'}->{'type'}
                   and $current->{'parent'}->{'parent'}->{'type'} eq 
'def_line');
+            # empty_spaces_before_argument is a transient internal type,
+            # which should end up in extra spaces_before_argument.
             push @{$current->{'contents'}},
                 {'type' => 'empty_spaces_before_argument',
                  'text' => '',
@@ -5768,6 +5783,8 @@ sub _parse_texi($$$)
           push @{$current->{'args'}},
                { 'type' => $type, 'parent' => $current, 'contents' => [] };
           $current = $current->{'args'}->[-1];
+          # empty_spaces_before_argument is a transient internal type,
+          # which should end up in extra spaces_before_argument.
           push @{$current->{'contents'}},
                  {'type' => 'empty_spaces_before_argument',
                   'text' => '',
@@ -6884,8 +6901,8 @@ I<brace_command_arg> for the container holding the brace 
@-commands
 contents, I<line_arg> and I<block_line_arg> contain the arguments
 appearing on the line of @-commands.  Text fragments may have a type to
 give an information of the kind of text fragment, for example
-I<empty_spaces_before_argument> is associated to spaces after a brace
-opening and before the argument.  Many @-commands elements do not have
+I<empty_spaces_before_paragraph> is associated to spaces appearing
+before a paragraph beginning.  Many @-commands elements do not have
 a type associated.
 
 =item args
@@ -7035,12 +7052,7 @@ takes an argument on the line or a block @-command.
 =item empty_spaces_after_close_brace
 
 Spaces appearing after a closing brace, for some rare commands for which
-this space should be ignorable (like C<@caption>).
-
-=item empty_spaces_before_argument
-
-The text is spaces appearing after an opening brace or after a
-comma separating a command's arguments.
+this space should be ignorable (like C<@caption> or C<@sortas>).
 
 =item empty_spaces_before_paragraph
 
@@ -7339,14 +7351,6 @@ C<@frenchspacing>, C<@alias>, C<@synindex>, 
C<@columnfractions>.
 Also filled for C<@set>, C<@clickstyle>, C<@unmacro> or C<@comment>
 arguments.
 
-=item spaces_before_argument
-
-For @-commands with opening brace or comma followed by spaces held in a
-I<empty_spaces_before_argument> element, a reference to those spaces.
-For context brace commands, I<spaces_before_argument> is associated
-with the @-command element, for other brace commands it is associated
-with each argument elements.
-
 =item spaces
 
 For accent commands acting on one letter only, like C<@ringaccent>
@@ -7359,6 +7363,21 @@ the command and the argument.
 
 =back
 
+=item spaces_before_argument
+
+A reference to spaces following some @-commands and bracketed content type
+with opening brace, line commands and block command lines taking Texinfo
+as argument and comma delimited arguments.  For context brace commands,
+line commands and block commands, I<spaces_before_argument> is associated with
+the @-command element, for other brace commands and for spaces after comma,
+it is associated with each argument element.
+
+=item spaces_after_argument
+
+A reference to spaces after @-command arguments before a comma, a closing
+brace or at end of line.  The @-commands with I<spaces_after_argument>
+should be the same as those with I<spaces_before_argument>.
+
 =head3 Extra keys specific of certain @-commands or containers
 
 =over



reply via email to

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