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, _parse_texi), tp/Texinfo/XS/parsetexi/parser.c (parse_texi), tp/Texinfo/XS/parsetexi/separator.c (handle_open_brace) (handle_close_brace): do not abort empty line if there is a misplaced brace. Abort empty line at the very end of the document.
Date: Sun, 05 Mar 2023 12:12:38 -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 9757a79810 * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, 
_parse_texi), tp/Texinfo/XS/parsetexi/parser.c (parse_texi), 
tp/Texinfo/XS/parsetexi/separator.c (handle_open_brace) (handle_close_brace): 
do not abort empty line if there is a misplaced brace.  Abort empty line at the 
very end of the document.
9757a79810 is described below

commit 9757a798103c3b0291cf302591324562b83dfa3f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Mar 5 18:09:01 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, _parse_texi),
    tp/Texinfo/XS/parsetexi/parser.c (parse_texi),
    tp/Texinfo/XS/parsetexi/separator.c (handle_open_brace)
    (handle_close_brace): do not abort empty line if there is a misplaced
    brace.  Abort empty line at the very end of the document.
---
 ChangeLog                                          |  8 ++++++++
 tp/Texinfo/ParserNonXS.pm                          | 14 ++++++++++++--
 tp/Texinfo/XS/parsetexi/parser.c                   |  1 +
 tp/Texinfo/XS/parsetexi/separator.c                | 14 ++++++++++----
 .../coverage/spaces_after_braced_command.pl        | 22 ++++++++++++----------
 tp/t/results/include/cpp_lines.pl                  |  9 +++++----
 .../invalid_nestings/cartouche_in_style_command.pl |  3 ++-
 tp/t/results/invalid_nestings/center.pl            |  6 ++++--
 .../invalid_nestings/ref_to_top_in_anchor.pl       |  4 ----
 tp/t/results/invalid_nestings/table_in_code.pl     |  3 ++-
 tp/t/results/invalid_nestings/verbatim_in_ref.pl   |  3 ++-
 tp/t/results/macro/macro_in_ifset_end_in_arg.pl    |  3 ++-
 .../misc_commands/definfoenclose_nestings.pl       |  3 ++-
 tp/t/results/paragraph/double_style_paragraph.pl   | 18 ++++++++++--------
 tp/t/results/raw/lone_braces_in_html.pl            |  4 ++++
 tp/t/results/raw/verbatim_in_brace_command.pl      |  3 ++-
 tp/t/results/sectioning/node_empty_direction.pl    |  2 +-
 tp/t/results/value/bad_syntax.pl                   |  3 ++-
 .../xtable/invalid_command_and_brace_in_table.pl   |  5 +++--
 .../formatting/res_parser/cpp_lines/cpp_lines.html |  2 +-
 20 files changed, 85 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 547b86726d..1f0792541e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,14 @@
        * tp/t/19def.t (defline_no_params, adjacent_defline, multiple_defline)
        (defblock_no_defline): New tests.
 
+2023-03-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, _parse_texi),
+       tp/Texinfo/XS/parsetexi/parser.c (parse_texi),
+       tp/Texinfo/XS/parsetexi/separator.c (handle_open_brace)
+       (handle_close_brace): do not abort empty line if there is a misplaced
+       brace.  Abort empty line at the very end of the document.
+
 2023-03-05  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line): move
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index fd67f3b748..9c1ea175ed 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2045,6 +2045,7 @@ sub _close_current($$$;$$)
   } elsif ($current->{'type'}) {
     print STDERR "CLOSING type $current->{'type'}\n" if ($self->{'DEBUG'});
     if ($current->{'type'} eq 'bracketed') {
+      # unclosed bracketed
       $self->_command_error($current, $source_info, __("misplaced {"));
       if ($current->{'contents'}
           and $current->{'contents'}->[0]->{'type'}
@@ -6204,7 +6205,6 @@ sub _process_remaining_on_line($$$$)
       $self->_line_error(__("unexpected \@"), $source_info);
     } elsif ($separator eq '{') {
       # handle_open_brace in XS parser
-      _abort_empty_line($self, $current);
       if ($current->{'cmdname'}
            and defined($self->{'brace_commands'}->{$current->{'cmdname'}})) {
         my $command = $current->{'cmdname'};
@@ -6309,6 +6309,7 @@ sub _process_remaining_on_line($$$$)
                       and $current->{'parent'}->{'cmdname'} eq 'multitable')
                      or ($current->{'parent'}->{'type'}
                          and $current->{'parent'}->{'type'} eq 'def_line'))) {
+        _abort_empty_line($self, $current);
         push @{$current->{'contents'}},
              { 'type' => 'bracketed',
                'parent' => $current };
@@ -6329,6 +6330,8 @@ sub _process_remaining_on_line($$$$)
       # lone braces accepted right in a rawpreformatted
       } elsif ($current->{'type'}
                and $current->{'type'} eq 'rawpreformatted') {
+        # FIXME can this really happen?  check if _abort_empty_line is needed
+        # if yes.
         push @{$current->{'contents'}}, {'text' => '{',
                                          'parent' => $current };
       # matching braces accepted in a rawpreformatted or math or ignored
@@ -6336,6 +6339,7 @@ sub _process_remaining_on_line($$$$)
       } elsif ($self->_top_context() eq 'ct_math'
                or $self->_top_context() eq 'ct_rawpreformatted'
                or $self->_top_context() eq 'ct_inlineraw') {
+        _abort_empty_line($self, $current);
         push @{$current->{'contents'}},
              { 'type' => 'bracketed',
                'parent' => $current, 'source_info' => $source_info };
@@ -6348,22 +6352,24 @@ sub _process_remaining_on_line($$$$)
 
     } elsif ($separator eq '}') {
       # handle_close_brace in XS parser
-      _abort_empty_line($self, $current);
 
       # For footnote and caption closing, when there is a paragraph inside.
       # This makes the brace command the parent element.
       if ($current->{'parent'} and $current->{'parent'}->{'type'}
             and $current->{'parent'}->{'type'} eq 'brace_command_context') {
+         _abort_empty_line($self, $current);
          $current = _end_paragraph($self, $current, $source_info);
       }
 
       if ($current->{'type'} and ($current->{'type'} eq 'bracketed')) {
         # Used in @math
+        _abort_empty_line($self, $current);
         $current = $current->{'parent'};
       } elsif ($current->{'parent'}
           and $current->{'parent'}->{'cmdname'}
           and exists($self->{'brace_commands'}
                                      ->{$current->{'parent'}->{'cmdname'}})) {
+        _abort_empty_line($self, $current);
         # first is the arg.
         if ($brace_commands{$current->{'parent'}->{'cmdname'}}
             and $brace_commands{$current->{'parent'}{'cmdname'}} eq 'arguments'
@@ -6587,6 +6593,9 @@ sub _process_remaining_on_line($$$$)
       # lone braces accepted right in a rawpreformatted
       } elsif ($current->{'type'}
                and $current->{'type'} eq 'rawpreformatted') {
+        # empty line can happen in expanded rawpreformatted.
+        # FIXME should it?
+        _abort_empty_line($self, $current);
         push @{$current->{'contents'}}, {'text' => '}',
                                          'parent' => $current };
 
@@ -6889,6 +6898,7 @@ sub _parse_texi($$$)
       if (! defined($line)) {
         print STDERR "END LINE in line loop STILL_MORE_TO_PROCESS\n"
                                                  if ($self->{'DEBUG'});
+        _abort_empty_line($self, $current);
         $current = _end_line($self, $current, $source_info);
         # It may happen that there was an @include file on the line, it
         # was pushed to input in _end_line, its contents will be picked up at
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 3df99e4714..b946cd11b5 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2416,6 +2416,7 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
             goto finished_totally;
           if (!line)
             {
+              abort_empty_line (&current, NULL);
               current = end_line (current);
               break;
             }
diff --git a/tp/Texinfo/XS/parsetexi/separator.c 
b/tp/Texinfo/XS/parsetexi/separator.c
index dd646710a3..ad1bf2ab6c 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -30,7 +30,6 @@ handle_open_brace (ELEMENT *current, char **line_inout)
 {
   char *line = *line_inout;
 
-  abort_empty_line (&current, NULL);
   if (command_flags(current) & CF_brace)
     {
       enum command_id command;
@@ -170,6 +169,7 @@ handle_open_brace (ELEMENT *current, char **line_inout)
            || current->parent->type == ET_def_line))
     {
       ELEMENT *b, *e;
+      abort_empty_line (&current, NULL);
       b = new_element (ET_bracketed);
       add_to_element_contents (current, b);
       current = b;
@@ -196,6 +196,7 @@ handle_open_brace (ELEMENT *current, char **line_inout)
            || current_context() == ct_inlineraw)
     {
       ELEMENT *b = new_element (ET_bracketed);
+      abort_empty_line (&current, NULL);
       b->source_info = current_source_info;
       add_to_element_contents (current, b);
       current = b;
@@ -234,16 +235,18 @@ handle_close_brace (ELEMENT *current, char **line_inout)
 {
   char *line = *line_inout;
 
-  abort_empty_line (&current, NULL);
-
   /* For footnote and caption closing, when there is a paragraph inside.
      This makes the brace command the parent element. */
   if (current->parent && current->parent->type == ET_brace_command_context)
-    current = end_paragraph (current, 0, 0);
+    {
+      abort_empty_line (&current, NULL);
+      current = end_paragraph (current, 0, 0);
+    }
 
   if (current->type == ET_bracketed)
     {
       /* Used in @math */
+      abort_empty_line (&current, NULL);
       current = current->parent;
       goto funexit;
     }
@@ -251,6 +254,8 @@ handle_close_brace (ELEMENT *current, char **line_inout)
     {
       enum command_id closed_command;
 
+      abort_empty_line (&current, NULL);
+
       /* determine if trailing spaces are ignored */
       if (command_data(current->parent->cmd).data == BRACE_arguments)
         isolate_last_space (current);
@@ -520,6 +525,7 @@ handle_close_brace (ELEMENT *current, char **line_inout)
     {
       /* lone right braces are accepted in a rawpreformatted */
       ELEMENT *e = new_element (ET_NONE);
+      abort_empty_line (&current, NULL);
       text_append_n (&e->text, "}", 1);
       add_to_element_contents (current, e);
       goto funexit;
diff --git a/tp/t/results/coverage/spaces_after_braced_command.pl 
b/tp/t/results/coverage/spaces_after_braced_command.pl
index aa30dd4435..6a5de9ad98 100644
--- a/tp/t/results/coverage/spaces_after_braced_command.pl
+++ b/tp/t/results/coverage/spaces_after_braced_command.pl
@@ -190,14 +190,15 @@ $result_trees{'spaces_after_braced_command'} = {
             },
             {
               'text' => '
-'
-            },
-            {
-              'text' => '
 '
             }
           ],
           'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
         }
       ],
       'type' => 'before_node_section'
@@ -326,6 +327,7 @@ 
$result_converted{'plaintext'}->{'spaces_after_braced_command'} = '‘b’
    b <a>
 
    TeX
+
 ';
 
 
@@ -339,8 +341,8 @@ 
$result_converted{'html_text'}->{'spaces_after_braced_command'} = '<p><code clas
 </a>
 </p>
 <p>TeX
-
-</p>';
+</p>
+';
 
 
 $result_converted{'xml'}->{'spaces_after_braced_command'} = '<para><code 
spacesaftercmd=" ">b</code>
@@ -353,8 +355,8 @@ $result_converted{'xml'}->{'spaces_after_braced_command'} = 
'<para><code spacesa
  </emailname></email>
 </para>
 <para>&tex;
-
-</para>';
+</para>
+';
 
 
 $result_converted{'latex_text'}->{'spaces_after_braced_command'} = '\\texttt{b}
@@ -381,7 +383,7 @@ 
$result_converted{'docbook'}->{'spaces_after_braced_command'} = '<para><literal>
 </ulink>
 </para>
 <para>&tex;
-
-</para>';
+</para>
+';
 
 1;
diff --git a/tp/t/results/include/cpp_lines.pl 
b/tp/t/results/include/cpp_lines.pl
index ad58fee20d..9db668a951 100644
--- a/tp/t/results/include/cpp_lines.pl
+++ b/tp/t/results/include/cpp_lines.pl
@@ -1111,10 +1111,6 @@ $result_trees{'cpp_lines'} = {
           'contents' => [
             {
               'text' => 'etext4
-'
-            },
-            {
-              'text' => '
 '
             }
           ],
@@ -1137,6 +1133,11 @@ $result_trees{'cpp_lines'} = {
         },
         {
           'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'text' => '
 ',
           'type' => 'empty_line'
         },
diff --git a/tp/t/results/invalid_nestings/cartouche_in_style_command.pl 
b/tp/t/results/invalid_nestings/cartouche_in_style_command.pl
index d41eb1a3d3..d4327bad4f 100644
--- a/tp/t/results/invalid_nestings/cartouche_in_style_command.pl
+++ b/tp/t/results/invalid_nestings/cartouche_in_style_command.pl
@@ -97,7 +97,8 @@ $result_trees{'cartouche_in_style_command'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/t/results/invalid_nestings/center.pl 
b/tp/t/results/invalid_nestings/center.pl
index d8cfc2d121..242f902640 100644
--- a/tp/t/results/invalid_nestings/center.pl
+++ b/tp/t/results/invalid_nestings/center.pl
@@ -339,7 +339,8 @@ $result_trees{'center'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         },
         {
           'text' => '
@@ -420,7 +421,8 @@ $result_trees{'center'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         },
         {
           'text' => '
diff --git a/tp/t/results/invalid_nestings/ref_to_top_in_anchor.pl 
b/tp/t/results/invalid_nestings/ref_to_top_in_anchor.pl
index 3b3dda1b53..78897aec21 100644
--- a/tp/t/results/invalid_nestings/ref_to_top_in_anchor.pl
+++ b/tp/t/results/invalid_nestings/ref_to_top_in_anchor.pl
@@ -73,10 +73,6 @@ $result_trees{'ref_to_top_in_anchor'} = {
             'line_nr' => 2,
             'macro' => ''
           }
-        },
-        {
-          'text' => '',
-          'type' => 'spaces_after_close_brace'
         }
       ],
       'extra' => {
diff --git a/tp/t/results/invalid_nestings/table_in_code.pl 
b/tp/t/results/invalid_nestings/table_in_code.pl
index 6cd3f06473..77d4fde9e4 100644
--- a/tp/t/results/invalid_nestings/table_in_code.pl
+++ b/tp/t/results/invalid_nestings/table_in_code.pl
@@ -164,7 +164,8 @@ $result_trees{'table_in_code'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/t/results/invalid_nestings/verbatim_in_ref.pl 
b/tp/t/results/invalid_nestings/verbatim_in_ref.pl
index 7255d82aaf..ccfe8f7c88 100644
--- a/tp/t/results/invalid_nestings/verbatim_in_ref.pl
+++ b/tp/t/results/invalid_nestings/verbatim_in_ref.pl
@@ -127,7 +127,7 @@ $result_trees{'verbatim_in_ref'} = {
         {
           'text' => '
 ',
-          'type' => 'spaces_before_paragraph'
+          'type' => 'empty_line'
         },
         {
           'contents' => [
@@ -168,6 +168,7 @@ verbat text
 
 $result_texts{'verbatim_in_ref'} = '
 firstverbat text
+
 .';
 
 $result_nodes{'verbatim_in_ref'} = {
diff --git a/tp/t/results/macro/macro_in_ifset_end_in_arg.pl 
b/tp/t/results/macro/macro_in_ifset_end_in_arg.pl
index f3398a1ffe..2ea856ade1 100644
--- a/tp/t/results/macro/macro_in_ifset_end_in_arg.pl
+++ b/tp/t/results/macro/macro_in_ifset_end_in_arg.pl
@@ -152,7 +152,8 @@ $result_trees{'macro_in_ifset_end_in_arg'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         },
         {
           'contents' => [
diff --git a/tp/t/results/misc_commands/definfoenclose_nestings.pl 
b/tp/t/results/misc_commands/definfoenclose_nestings.pl
index f72943816a..06993a54db 100644
--- a/tp/t/results/misc_commands/definfoenclose_nestings.pl
+++ b/tp/t/results/misc_commands/definfoenclose_nestings.pl
@@ -214,7 +214,8 @@ $result_trees{'definfoenclose_nestings'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/t/results/paragraph/double_style_paragraph.pl 
b/tp/t/results/paragraph/double_style_paragraph.pl
index a6f81d57ee..0a9d2fa1be 100644
--- a/tp/t/results/paragraph/double_style_paragraph.pl
+++ b/tp/t/results/paragraph/double_style_paragraph.pl
@@ -61,18 +61,20 @@ $result_trees{'double_style_paragraph'} = {
           'contents' => [
             {
               'text' => 'Second para.
-'
-            },
-            {
-              'text' => '
-'
-            },
-            {
-              'text' => '
 '
             }
           ],
           'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/t/results/raw/lone_braces_in_html.pl 
b/tp/t/results/raw/lone_braces_in_html.pl
index 949ec59dcb..f844dfda8e 100644
--- a/tp/t/results/raw/lone_braces_in_html.pl
+++ b/tp/t/results/raw/lone_braces_in_html.pl
@@ -92,6 +92,10 @@ $result_trees{'lone_braces_in_html'} = {
           'contents' => [
             {
               'contents' => [
+                {
+                  'text' => '',
+                  'type' => 'empty_line'
+                },
                 {
                   'text' => '{
 '
diff --git a/tp/t/results/raw/verbatim_in_brace_command.pl 
b/tp/t/results/raw/verbatim_in_brace_command.pl
index 835430daf4..535c25738a 100644
--- a/tp/t/results/raw/verbatim_in_brace_command.pl
+++ b/tp/t/results/raw/verbatim_in_brace_command.pl
@@ -93,7 +93,8 @@ $result_trees{'verbatim_in_brace_command'} = {
         },
         {
           'text' => '
-'
+',
+          'type' => 'empty_line'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/t/results/sectioning/node_empty_direction.pl 
b/tp/t/results/sectioning/node_empty_direction.pl
index 28527eda0e..a27908941f 100644
--- a/tp/t/results/sectioning/node_empty_direction.pl
+++ b/tp/t/results/sectioning/node_empty_direction.pl
@@ -22,7 +22,7 @@ $result_trees{'node_empty_direction'} = {
         },
         {
           'info' => {
-            'spaces_after_argument' => {
+            'spaces_before_argument' => {
               'text' => ' '
             }
           },
diff --git a/tp/t/results/value/bad_syntax.pl b/tp/t/results/value/bad_syntax.pl
index 597ad6214b..5f3d1f074c 100644
--- a/tp/t/results/value/bad_syntax.pl
+++ b/tp/t/results/value/bad_syntax.pl
@@ -85,7 +85,7 @@ $result_trees{'bad_syntax'} = {
         {
           'text' => '
 ',
-          'type' => 'spaces_before_paragraph'
+          'type' => 'empty_line'
         },
         {
           'contents' => [
@@ -140,6 +140,7 @@ gurgl
 
 $result_texts{'bad_syntax'} = '
 
+
 gurgl
 
 
diff --git a/tp/t/results/xtable/invalid_command_and_brace_in_table.pl 
b/tp/t/results/xtable/invalid_command_and_brace_in_table.pl
index 76703535e7..e3d0318ff4 100644
--- a/tp/t/results/xtable/invalid_command_and_brace_in_table.pl
+++ b/tp/t/results/xtable/invalid_command_and_brace_in_table.pl
@@ -37,7 +37,8 @@ $result_trees{'invalid_command_and_brace_in_table'} = {
             {
               'contents' => [
                 {
-                  'text' => ' '
+                  'text' => ' ',
+                  'type' => 'spaces_before_paragraph'
                 },
                 {
                   'contents' => [
@@ -122,7 +123,7 @@ Item line
 ';
 
 
-$result_texts{'invalid_command_and_brace_in_table'} = ' ,, title
+$result_texts{'invalid_command_and_brace_in_table'} = ',, title
 long title
 Item line
 ';
diff --git a/tp/tests/formatting/res_parser/cpp_lines/cpp_lines.html 
b/tp/tests/formatting/res_parser/cpp_lines/cpp_lines.html
index 7f223aa585..906a1e9251 100644
--- a/tp/tests/formatting/res_parser/cpp_lines/cpp_lines.html
+++ b/tp/tests/formatting/res_parser/cpp_lines/cpp_lines.html
@@ -82,12 +82,12 @@ span:hover a.copiable-link {visibility: visible}
 </p>
 
 <p>etext4
-
 </p>
 
 
 
 
+
 <div class="footnotes-segment">
 <hr>
 <h4 class="footnotes-heading">Footnotes</h4>



reply via email to

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