bug-texinfo
[Top][All Lists]
Advanced

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

Re: “bug: Nothing closed while a line context remains” with Texinfo 7.0.


From: Arsen Arsenović
Subject: Re: “bug: Nothing closed while a line context remains” with Texinfo 7.0.3
Date: Wed, 19 Apr 2023 17:59:31 +0200

[CC += Patrice as the author of the original patch]

Arsen Arsenović <arsen@aarsen.me> writes:

> To my untrained-to-the-parser eyes, it seems like the parser is trying
> to parse @end as part of @item and getting confused (whereas the
> unaffected version parses @item first, with no argument, and then @end).
>
> I'll try to bisect and come up with a fix.  Everyone should feel free to
> beat me to it, though.

It appears that b225268a2ecdc58a06faa73c629ae1810942989f fixed this
issue on master.

I've made a brief attempt at backporting the changes from there by hand,
here's the resulting patch.  I'm not confident in my knowledge of the
parser code, though, so I'd like second opinions.

From da12afe448c234396c6b4897bff9fad6e9f35885 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
Date: Wed, 19 Apr 2023 18:36:47 +0200
Subject: [PATCH] Backport b225268a2ecdc58a06faa73c629ae1810942989f

corresponding to 2023-02-01 Patrice Dumas <pertusus@free.fr> to fix the
parsing of @table @asis\n@item @end table inducing a bug.

Report from Florian Weimer.
* tp/Texinfo/ParserNonXS.pm (_close_current, _end_line),
tp/Texinfo/XS/parsetexi/close.c (close_current),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): close all
the type elements without content nor information associated in
one place only, in close_current.
* tp/tests/contents/list-of-tests: Add parse_weird_end_table test.
* tp/tests/contents/Makefile.am (EXTRA_DIST): Ditto.
---
 ChangeLog                                     | 15 +++++++++
 tp/Texinfo/ParserNonXS.pm                     | 27 +++++++++-------
 tp/Texinfo/XS/parsetexi/close.c               | 31 +++++++++----------
 tp/Texinfo/XS/parsetexi/end_line.c            | 11 -------
 tp/tests/Makefile.onetst                      |  1 +
 tp/tests/contents/Makefile.am                 |  2 +-
 tp/tests/contents/list-of-tests               |  1 +
 tp/tests/contents/parse_weird_end_table.texi  |  2 ++
 .../parse_weird_end_table.1                   |  0
 .../parse_weird_end_table.2                   |  1 +
 .../parse_weird_end_table.info                | 13 ++++++++
 .../formatting_docbook/formatting.xml         |  8 ++---
 .../formatting_macro_expand/formatting.texi   | 12 +++----
 .../res_parser/formatting_xml/formatting.xml  |  8 ++---
 .../contents_parse_weird_end_table.sh         | 19 ++++++++++++
 15 files changed, 95 insertions(+), 56 deletions(-)
 create mode 100644 tp/tests/contents/parse_weird_end_table.texi
 create mode 100644 
tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.1
 create mode 100644 
tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.2
 create mode 100644 
tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.info
 create mode 100755 tp/tests/test_scripts/contents_parse_weird_end_table.sh

diff --git a/ChangeLog b/ChangeLog
index b39ddc496a..065d8805c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2023-04-19  Arsen Arsenović  <arsen@aarsen.me>
+
+       Backport b225268a2ecdc58a06faa73c629ae1810942989f, corresponding
+       to 2023-02-01  Patrice Dumas  <pertusus@free.fr> to fix the
+       parsing of @table @asis\n@item @end table inducing a bug.
+
+       Report from Florian Weimer.
+       * tp/Texinfo/ParserNonXS.pm (_close_current, _end_line),
+       tp/Texinfo/XS/parsetexi/close.c (close_current),
+       tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): close all
+       the type elements without content nor information associated in
+       one place only, in close_current.
+       * tp/tests/contents/list-of-tests: Add parse_weird_end_table test.
+       * tp/tests/contents/Makefile.am (EXTRA_DIST): Ditto.
+
 2023-01-29  Gavin Smith <gavinsmith0123@gmail.com>
 
        Fix 'info (manual)slash/in/node'
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index cf87a6d219..a3fba06afe 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1853,7 +1853,22 @@ sub _close_current($$$;$$)
     # empty types, not closed or associated to a command that is not closed
     delete $current->{'contents'}
       if ($current->{'contents'} and !@{$current->{'contents'}});
+    # remove element without contents nor associated information
+    my $element_to_remove;
+    if (not $current->{'contents'}
+        and not $current->{'args'}
+        and (not defined($current->{'text'}) or $current->{'text'} eq '')
+        and not $current->{'info'}
+        and (not $current->{'source_marks'}
+             or not scalar(@{$current->{'source_marks'}}))) {
+      $element_to_remove = $current;
+    }
     $current = $current->{'parent'};
+    _pop_element_from_contents($self, $current)
+      if ($element_to_remove
+          and $current->{'contents'}
+          and scalar(@{$current->{'contents'}})
+          and $current->{'contents'}->[-1] eq $element_to_remove);
   } else { # Should never go here.
     $current = $current->{'parent'} if ($current->{'parent'});
     $self->_bug_message("No type nor cmdname when closing",
@@ -3475,18 +3490,6 @@ sub _end_line($$$)
       # reparent to block command
       my $end = _pop_element_from_contents($current);
       if ($block_commands{$end_command} ne 'conditional') {
-        # here close some empty types.  Typically empty preformatted
-        # that would have been closed anyway in _close_commands, but
-        # also other types (rawpreformatted, before_item), some which
-        # may also have been closed anyway.
-        if (not defined($current->{'cmdname'}) and $current->{'type'}
-            and !$current->{'contents'}
-            and $current->{'parent'}) {
-           my $removed = pop @{$current->{'parent'}->{'contents'}};
-           print STDERR "popping at end command $end_command: 
$removed->{'type'}\n"
-              if ($self->{'DEBUG'});
-           $current = $current->{'parent'};
-        }
         my $closed_command;
         ($closed_command, $current)
           = _close_commands($self, $current, $source_info, $end_command);
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index 08b2113a08..de445049ce 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -328,6 +328,7 @@ close_current (ELEMENT *current,
   else if (current->type != ET_NONE)
     {
       enum context c;
+      ELEMENT *element_to_remove = 0;
       debug ("CLOSING type %s", element_type_names[current->type]);
       switch (current->type)
         {
@@ -340,20 +341,6 @@ close_current (ELEMENT *current,
               /* remove spaces element from tree and update extra values */
               abort_empty_line (&current, 0);
            }
-          current = current->parent;
-
-          break;
-        case ET_menu_comment:
-        case ET_menu_entry_description:
-          /* Remove empty menu_comment */
-          if (current->type == ET_menu_comment
-              && current->contents.number == 0)
-            {
-              current = current->parent;
-              destroy_element (pop_element_from_contents (current));
-            }
-          else
-            current = current->parent;
 
           break;
         case ET_line_arg:
@@ -364,12 +351,24 @@ close_current (ELEMENT *current,
               /* error */
               fatal ("line or def context expected");
             }
-          current = current->parent;
+
           break;
         default:
-          current = current->parent;
+
           break;
         }
+      /* remove element without contents nor associated information */
+      if (current->contents.number == 0
+          && current->args.number == 0
+          && current->text.end == 0)
+        element_to_remove = current;
+      current = current->parent;
+      if (element_to_remove)
+        {
+          ELEMENT *last_child = last_contents_child (current);
+          if (last_child == element_to_remove)
+            destroy_element (pop_element_from_contents (current));
+        }
     }
   else
     {
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 87ca036edd..57dca367e8 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1787,17 +1787,6 @@ end_line_misc_line (ELEMENT *current)
       if (command_data(end_id).data != BLOCK_conditional)
         {
           ELEMENT *closed_command;
-          /* here close some empty types.  Typically empty preformatted
-             that would have been closed anyway in _close_commands, but
-             also other types (rawpreformatted, before_item), some which
-             may also have been closed anyway. */
-          if (!current->cmd && current->type != ET_NONE
-              && (current->contents.number == 0) && current->parent)
-             {
-               current = current->parent;
-               destroy_element (pop_element_from_contents (current));
-               debug ("popping at end command");
-             }
           /* This closes tree elements (e.g. paragraphs) until we reach
              end_command.  It can print an error if another block command
              is found first. */
diff --git a/tp/tests/Makefile.onetst b/tp/tests/Makefile.onetst
index a40bc928ac..392eed9094 100644
--- a/tp/tests/Makefile.onetst
+++ b/tp/tests/Makefile.onetst
@@ -105,6 +105,7 @@ type_base_one_test_files_generated_list =  \
     test_scripts/contents_contents_in_middle_chapter_info.sh \
     test_scripts/contents_contents_in_middle_section_info.sh \
     test_scripts/contents_double_contents_info.sh \
+    test_scripts/contents_parse_weird_end_table.sh \
     test_scripts/layout_no_monolithic_only_toc_out.sh \
     test_scripts/layout_navigation_test_misc_file_collision.sh \
     test_scripts/layout_formatting_macro_expand.sh \
diff --git a/tp/tests/contents/Makefile.am b/tp/tests/contents/Makefile.am
index 3bab4a404f..6519b6bfe2 100644
--- a/tp/tests/contents/Makefile.am
+++ b/tp/tests/contents/Makefile.am
@@ -1,7 +1,7 @@
 EXTRA_DIST = contents_at_begin.texi contents_at_end.texi \
  contents_in_middle_chapter.texi contents_in_middle_section.texi \
  double_contents.texi no_content.texi no_content_setcatpage.texi \
- contents_and_parts.texi \
+ contents_and_parts.texi parse_weird_end_table.texi \
  res_parser list-of-tests
 
 DISTCLEANFILES = tests.log tests.out
diff --git a/tp/tests/contents/list-of-tests b/tp/tests/contents/list-of-tests
index 8a1897f325..4edf76dc4e 100644
--- a/tp/tests/contents/list-of-tests
+++ b/tp/tests/contents/list-of-tests
@@ -36,3 +36,4 @@ contents_in_middle_chapter_info 
contents_in_middle_chapter.texi --info
 contents_in_middle_section_info contents_in_middle_section.texi --info
 double_contents_info double_contents.texi --info
 
+parse_weird_end_table parse_weird_end_table.texi --info
diff --git a/tp/tests/contents/parse_weird_end_table.texi 
b/tp/tests/contents/parse_weird_end_table.texi
new file mode 100644
index 0000000000..4a27398883
--- /dev/null
+++ b/tp/tests/contents/parse_weird_end_table.texi
@@ -0,0 +1,2 @@
+@table @asis
+@item @end table
diff --git 
a/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.1 
b/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.1
new file mode 100644
index 0000000000..e69de29bb2
diff --git 
a/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.2 
b/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.2
new file mode 100644
index 0000000000..c1380bf5dd
--- /dev/null
+++ b/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.2
@@ -0,0 +1 @@
+parse_weird_end_table.texi: warning: document without nodes
diff --git 
a/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.info 
b/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.info
new file mode 100644
index 0000000000..6dc675b923
--- /dev/null
+++ 
b/tp/tests/contents/res_parser/parse_weird_end_table/parse_weird_end_table.info
@@ -0,0 +1,13 @@
+This is parse_weird_end_table.info, produced by texi2any version from
+parse_weird_end_table.texi.
+
+
+
+Tag Table:
+
+End Tag Table
+
+
+Local Variables:
+coding: utf-8
+End:
diff --git a/tp/tests/layout/res_parser/formatting_docbook/formatting.xml 
b/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
index e3885efb68..a19383503a 100644
--- a/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
+++ b/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
@@ -860,7 +860,7 @@ aaa</literallayout></textobject></inlinemediaobject>
 <synopsis><phrase role="category"><emphasis 
role="bold">fun</emphasis>:</phrase></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis>  <emphasis 
role="arg">after</emphasis></synopsis>
-<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg"></emphasis></synopsis>
+<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> </synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg">and after</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>followed</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>followed</function> <emphasis role="arg">by</emphasis> <emphasis 
role="arg">a</emphasis> <emphasis role="arg">comment</emphasis></synopsis>
 <!-- comment -->
@@ -1777,7 +1777,7 @@ aaa</literallayout></textobject></inlinemediaobject>
 <synopsis><phrase role="category"><emphasis 
role="bold">fun</emphasis>:</phrase></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis>  <emphasis 
role="arg">after</emphasis></synopsis>
-<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg"></emphasis></synopsis>
+<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> </synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg">and after</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>followed</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>followed</function> <emphasis role="arg">by</emphasis> <emphasis 
role="arg">a</emphasis> <emphasis role="arg">comment</emphasis></synopsis>
 <!-- comment -->
@@ -2681,7 +2681,7 @@ aaa</literallayout></textobject></inlinemediaobject>
 <synopsis><phrase role="category"><emphasis 
role="bold">fun</emphasis>:</phrase></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis>  <emphasis 
role="arg">after</emphasis></synopsis>
-<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg"></emphasis></synopsis>
+<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> </synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg">and after</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>followed</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>followed</function> <emphasis role="arg">by</emphasis> <emphasis 
role="arg">a</emphasis> <emphasis role="arg">comment</emphasis></synopsis>
 <!-- comment -->
@@ -3576,7 +3576,7 @@ aaa</literallayout></textobject></inlinemediaobject>
 </screen><synopsis><phrase role="category"><emphasis 
role="bold">fun</emphasis>:</phrase></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis>  <emphasis 
role="arg">after</emphasis></synopsis>
-<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg"></emphasis></synopsis>
+<synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> </synopsis>
 <synopsis><indexterm role="fn"><primary>machin</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>machin</function> <emphasis role="arg">bidule</emphasis> <emphasis 
role="arg">chose</emphasis> <emphasis role="arg">and</emphasis> <emphasis 
role="arg">and after</emphasis></synopsis>
 <synopsis><indexterm role="fn"><primary>followed</primary></indexterm><phrase 
role="category"><emphasis role="bold">truc</emphasis>:</phrase> 
<function>followed</function> <emphasis role="arg">by</emphasis> <emphasis 
role="arg">a</emphasis> <emphasis role="arg">comment</emphasis></synopsis>
 <screen><!-- comment -->
diff --git a/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi 
b/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
index 629c3d19e8..c34ad09333 100644
--- a/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
+++ b/tp/tests/layout/res_parser/formatting_macro_expand/formatting.texi
@@ -2293,8 +2293,7 @@
 @deffn fun
 @deffnx truc machin bidule chose and 
 @deffnx truc machin bidule chose and  after
-@deffnx truc machin bidule chose and {
-}@deffnx truc machin bidule chose and { and after
+@deffnx truc machin bidule chose and @deffnx truc machin bidule chose and { 
and after
 }@deffnx {truc} followed by a comment
 @c comment
 Various deff lines
@@ -3443,8 +3442,7 @@
 @deffn fun
 @deffnx truc machin bidule chose and 
 @deffnx truc machin bidule chose and  after
-@deffnx truc machin bidule chose and {
-}@deffnx truc machin bidule chose and { and after
+@deffnx truc machin bidule chose and @deffnx truc machin bidule chose and { 
and after
 }@deffnx {truc} followed by a comment
 @c comment
 Various deff lines
@@ -4619,8 +4617,7 @@ @node chapter
 @deffn fun
 @deffnx truc machin bidule chose and 
 @deffnx truc machin bidule chose and  after
-@deffnx truc machin bidule chose and {
-}@deffnx truc machin bidule chose and { and after
+@deffnx truc machin bidule chose and @deffnx truc machin bidule chose and { 
and after
 }@deffnx {truc} followed by a comment
 @c comment
 Various deff lines
@@ -5776,8 +5773,7 @@ @node chapter
 @deffn fun
 @deffnx truc machin bidule chose and 
 @deffnx truc machin bidule chose and  after
-@deffnx truc machin bidule chose and {
-}@deffnx truc machin bidule chose and { and after
+@deffnx truc machin bidule chose and @deffnx truc machin bidule chose and { 
and after
 }@deffnx {truc} followed by a comment
 @c comment
 Various deff lines
diff --git a/tp/tests/layout/res_parser/formatting_xml/formatting.xml 
b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
index 154bf59587..807e133994 100644
--- a/tp/tests/layout/res_parser/formatting_xml/formatting.xml
+++ b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
@@ -2286,7 +2286,7 @@ in verbatim ''
 <deffn spaces=" " endspaces=" 
"><definitionterm><defcategory>fun</defcategory></definitionterm>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="46">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="47">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam>  
<defparam>after</defparam></definitionterm></deffnx>
-<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="48">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces="\n"></defparam></definitionterm></deffnx>
+<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="48">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="49">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces=" ">and after</defparam></definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="50">followed</indexterm><defcategory bracketed="on">truc</defcategory> 
<deffunction>followed</deffunction> <defparam>by</defparam> 
<defparam>a</defparam> <defparam>comment</defparam></definitionterm></deffnx>
 <!-- c comment -->
@@ -3426,7 +3426,7 @@ in verbatim ''
 <deffn spaces=" " endspaces=" 
"><definitionterm><defcategory>fun</defcategory></definitionterm>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="98">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="99">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam>  
<defparam>after</defparam></definitionterm></deffnx>
-<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="100">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces="\n"></defparam></definitionterm></deffnx>
+<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="100">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="101">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces=" ">and after</defparam></definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="102">followed</indexterm><defcategory bracketed="on">truc</defcategory> 
<deffunction>followed</deffunction> <defparam>by</defparam> 
<defparam>a</defparam> <defparam>comment</defparam></definitionterm></deffnx>
 <!-- c comment -->
@@ -4593,7 +4593,7 @@ in verbatim ''
 <deffn spaces=" " endspaces=" 
"><definitionterm><defcategory>fun</defcategory></definitionterm>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="150">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="151">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam>  
<defparam>after</defparam></definitionterm></deffnx>
-<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="152">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces="\n"></defparam></definitionterm></deffnx>
+<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="152">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="153">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces=" ">and after</defparam></definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="154">followed</indexterm><defcategory bracketed="on">truc</defcategory> 
<deffunction>followed</deffunction> <defparam>by</defparam> 
<defparam>a</defparam> <defparam>comment</defparam></definitionterm></deffnx>
 <!-- c comment -->
@@ -5728,7 +5728,7 @@ Invalid use of &arobase;':&linebreak;
 </pre><deffn spaces=" " endspaces=" 
"><definitionterm><defcategory>fun</defcategory></definitionterm>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="202">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="203">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam>  
<defparam>after</defparam></definitionterm></deffnx>
-<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="204">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces="\n"></defparam></definitionterm></deffnx>
+<deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="204">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> </definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="205">machin</indexterm><defcategory>truc</defcategory> 
<deffunction>machin</deffunction> <defparam>bidule</defparam> 
<defparam>chose</defparam> <defparam>and</defparam> <defparam bracketed="on" 
spaces=" ">and after</defparam></definitionterm></deffnx>
 <deffnx spaces=" "><definitionterm><indexterm index="fn" 
number="206">followed</indexterm><defcategory bracketed="on">truc</defcategory> 
<deffunction>followed</deffunction> <defparam>by</defparam> 
<defparam>a</defparam> <defparam>comment</defparam></definitionterm></deffnx>
 <pre xml:space="preserve"><!-- c comment -->
diff --git a/tp/tests/test_scripts/contents_parse_weird_end_table.sh 
b/tp/tests/test_scripts/contents_parse_weird_end_table.sh
new file mode 100755
index 0000000000..643ff49aa4
--- /dev/null
+++ b/tp/tests/test_scripts/contents_parse_weird_end_table.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+# This file generated by maintain/regenerate_cmd_tests.sh
+
+if test z"$srcdir" = "z"; then
+  srcdir=.
+fi
+
+one_test_logs_dir=test_log
+
+
+dir=contents
+name='parse_weird_end_table'
+mkdir -p $dir
+
+"$srcdir"/run_parser_all.sh -dir $dir $name
+exit_status=$?
+cat $dir/$one_test_logs_dir/$name.log
+exit $exit_status
+
-- 
2.40.0

Result after applying:

~/gnu/texinfo-maint$ TEXINFO_XS=required ./pre-inst-env makeinfo test.texi
test.texi: warning: document without nodes
~/gnu/texinfo-maint$ ./pre-inst-env makeinfo test.texi
test.texi: warning: document without nodes
~/gnu/texinfo-maint$ cat test.texi
@table @asis 
@item @end table
~/gnu/texinfo-maint$ 

The original manual you provided also builds (but requires -F, since it
has errors since it contains @item @item lines).

Though, this fix feels 'coincidental', maybe there's a better solution.
Patrice, what do you think?

Thanks in advance, have a lovely day.
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature


reply via email to

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