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), tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): do not consider accent commands to be associated to @itemize or @*table. End the line if there is an accent followed by end of line on a block command or line command.
Date: Thu, 08 Dec 2022 13:56:46 -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 6a9526eff0 * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), 
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): do not consider 
accent commands to be associated to @itemize or @*table.  End the line if there 
is an accent followed by end of line on a block command or line command.
6a9526eff0 is described below

commit 6a9526eff0236981287f3b760fce1513064585f3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Dec 8 19:56:21 2022 +0100

    * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
    tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
    do not consider accent commands to be associated to @itemize
    or @*table.  End the line if there is an accent followed by
    end of line on a block command or line command.
---
 ChangeLog                                          |  8 +++++++
 tp/TODO                                            |  2 ++
 tp/Texinfo/ParserNonXS.pm                          | 15 +++++++++++++
 tp/Texinfo/XS/parsetexi/parser.c                   | 19 ++++++++++++++++
 tp/t/results/html_tests/itemize_arguments.pl       | 24 ++++++++++++++++++--
 .../itemize_arguments/res_html/index.html          |  4 ++--
 .../itemize_arguments_enable_encoding.pl           | 24 ++++++++++++++++++--
 .../res_html/index.html                            |  4 ++--
 .../invalid_nestings/section_on_itemize_line.pl    | 25 ++++++++++-----------
 .../invalid_nestings/section_on_xtable_line.pl     | 26 ++++++++++++++--------
 tp/t/results/itemize/accent_argument.pl            | 21 +++++++++++------
 tp/t/results/itemize/empty_accent_argument.pl      | 16 ++++++-------
 tp/t/results/xtable/accent_on_table_line.pl        | 16 +++++++++----
 13 files changed, 154 insertions(+), 50 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ee55851e8..fb32f6a1a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-12-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+       tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
+       do not consider accent commands to be associated to @itemize
+       or @*table.  End the line if there is an accent followed by
+       end of line on a block command or line command.
+
 2022-12-07  Patrice Dumas  <pertusus@free.fr>
 
        * tp/t/input_files/bib-example.texi: use @w{} to avoid mark command
diff --git a/tp/TODO b/tp/TODO
index d68ff237f2..b06ea5aab4 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,6 +13,8 @@ Before next release
 Bugs
 ====
 
+check that there are tests of @^{} and @ringaccent{?} on @itemize and @table 
lines.
+
 HTML API
 ========
 
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 57e47beaa3..8f036cab71 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4408,6 +4408,7 @@ sub _process_remaining_on_line($$$$)
   # prevail and lead to a missed command
   if ($current->{'cmdname'}
       and defined($self->{'brace_commands'}->{$current->{'cmdname'}})
+      and not $self->{'brace_commands'}->{$current->{'cmdname'}} eq 'accent'
       and !$open_brace
       and _parent_of_command_as_argument($current->{'parent'})) {
     _register_command_as_argument($self, $current);
@@ -4471,6 +4472,18 @@ sub _process_remaining_on_line($$$$)
         $self->_line_warn(sprintf(
            __("command `\@%s' must not be followed by new line"),
            $current->{'cmdname'}), $source_info);
+        my $top_context = $self->_top_context();
+        if ($top_context eq 'ct_line' or $top_context eq 'ct_def') {
+          # do not consider the end of line to be possibly between
+          # the @-command and the argument if at the end of a
+          # line or block @-command.
+          $current = $current->{'parent'};
+          $current = _merge_text($self, $current, $added_space);
+          _isolate_last_space($self, $current);
+          $current = _end_line($self, $current, $source_info);
+          $retval = $GET_A_NEW_LINE;
+          goto funexit;
+        }
         $additional_newline = 1;
       }
       #$current->{'info'} = {} if (!$current->{'info'});
@@ -5323,6 +5336,8 @@ sub _process_remaining_on_line($$$$)
         $line = _start_empty_line_after_command($line, $current, $block);
       }
     } elsif (defined($self->{'brace_commands'}->{$command})) {
+      print STDERR "OPEN BRACE \@$command\n"
+         if ($self->{'DEBUG'});
       push @{$current->{'contents'}}, { 'cmdname' => $command,
                                         'parent' => $current,
                                         };
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 1a26e18010..b988994b28 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1509,6 +1509,7 @@ superfluous_arg:
      Need to be done as early as possible such that no other condition
      prevail and lead to a missed command */
   if (command_flags(current) & CF_brace && *line != '{'
+      && command_data(current->cmd).data != BRACE_accent
       && parent_of_command_as_argument (current->parent))
     {
       register_command_as_argument (current);
@@ -1575,6 +1576,24 @@ superfluous_arg:
                  {
                    line_warn ("command `@%s' must not be followed by new line",
                               command_name(current->cmd));
+                   if (current_context() == ct_def
+                       || current_context() == ct_line)
+                     {
+                    /* do not consider the end of line to be possibly between
+                       the @-command and the argument if at the end of a
+                       line or block @-command. */
+                       char saved; /* TODO: Have a length argument to 
merge_text? */
+                       current = current->parent;
+                       saved = line[whitespaces_len];
+                       line[whitespaces_len] = '\0';
+                       current = merge_text (current, line);
+                       line += whitespaces_len;
+                       *line = saved;
+                       isolate_last_space (current);
+                       current = end_line (current);
+                       retval = GET_A_NEW_LINE;
+                       goto funexit;
+                     }
                    additional_newline = 1;
                    break;
                  }
diff --git a/tp/t/results/html_tests/itemize_arguments.pl 
b/tp/t/results/html_tests/itemize_arguments.pl
index fc6590b697..d85cf78a9d 100644
--- a/tp/t/results/html_tests/itemize_arguments.pl
+++ b/tp/t/results/html_tests/itemize_arguments.pl
@@ -1943,6 +1943,16 @@ $result_trees{'itemize_arguments'} = {
             {
               'contents' => [
                 {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'e'
+                        }
+                      ],
+                      'type' => 'following_arg'
+                    }
+                  ],
                   'cmdname' => '^',
                   'source_info' => {
                     'file_name' => '',
@@ -1951,7 +1961,7 @@ $result_trees{'itemize_arguments'} = {
                   }
                 },
                 {
-                  'text' => 'e '
+                  'text' => ' '
                 },
                 {
                   'args' => [
@@ -2127,6 +2137,16 @@ $result_trees{'itemize_arguments'} = {
             {
               'contents' => [
                 {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'E'
+                        }
+                      ],
+                      'type' => 'following_arg'
+                    }
+                  ],
                   'cmdname' => '^',
                   'source_info' => {
                     'file_name' => '',
@@ -2135,7 +2155,7 @@ $result_trees{'itemize_arguments'} = {
                   }
                 },
                 {
-                  'text' => 'E '
+                  'text' => ' '
                 },
                 {
                   'args' => [
diff --git a/tp/t/results/html_tests/itemize_arguments/res_html/index.html 
b/tp/t/results/html_tests/itemize_arguments/res_html/index.html
index 16806829ad..98ccc2a3f5 100644
--- a/tp/t/results/html_tests/itemize_arguments/res_html/index.html
+++ b/tp/t/results/html_tests/itemize_arguments/res_html/index.html
@@ -99,11 +99,11 @@ ul.mark-tie {list-style-type: " "}
 <li>item dots <small class="enddots">...</small> a
 </li></ul>
 
-<ul class="itemize" style="list-style-type: '\0302 e \00CA '">
+<ul class="itemize" style="list-style-type: '\00EA  \00CA '">
 <li>item e &ecirc; <small class="sc">&Ecirc;</small>
 </li></ul>
 
-<ul class="itemize" style="list-style-type: '\0302 E \00CA '">
+<ul class="itemize" style="list-style-type: '\00CA  \00CA '">
 <li>item E &Ecirc; <small class="sc">&Ecirc;</small>
 </li></ul>
 
diff --git a/tp/t/results/html_tests/itemize_arguments_enable_encoding.pl 
b/tp/t/results/html_tests/itemize_arguments_enable_encoding.pl
index 8181d470c9..ed41605934 100644
--- a/tp/t/results/html_tests/itemize_arguments_enable_encoding.pl
+++ b/tp/t/results/html_tests/itemize_arguments_enable_encoding.pl
@@ -1943,6 +1943,16 @@ $result_trees{'itemize_arguments_enable_encoding'} = {
             {
               'contents' => [
                 {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'e'
+                        }
+                      ],
+                      'type' => 'following_arg'
+                    }
+                  ],
                   'cmdname' => '^',
                   'source_info' => {
                     'file_name' => '',
@@ -1951,7 +1961,7 @@ $result_trees{'itemize_arguments_enable_encoding'} = {
                   }
                 },
                 {
-                  'text' => 'e '
+                  'text' => ' '
                 },
                 {
                   'args' => [
@@ -2127,6 +2137,16 @@ $result_trees{'itemize_arguments_enable_encoding'} = {
             {
               'contents' => [
                 {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'E'
+                        }
+                      ],
+                      'type' => 'following_arg'
+                    }
+                  ],
                   'cmdname' => '^',
                   'source_info' => {
                     'file_name' => '',
@@ -2135,7 +2155,7 @@ $result_trees{'itemize_arguments_enable_encoding'} = {
                   }
                 },
                 {
-                  'text' => 'E '
+                  'text' => ' '
                 },
                 {
                   'args' => [
diff --git 
a/tp/t/results/html_tests/itemize_arguments_enable_encoding/res_html/index.html 
b/tp/t/results/html_tests/itemize_arguments_enable_encoding/res_html/index.html
index ccfa956793..5ef97c776a 100644
--- 
a/tp/t/results/html_tests/itemize_arguments_enable_encoding/res_html/index.html
+++ 
b/tp/t/results/html_tests/itemize_arguments_enable_encoding/res_html/index.html
@@ -99,11 +99,11 @@ ul.mark-tie {list-style-type: " "}
 <li>item dots <small class="enddots">...</small> a
 </li></ul>
 
-<ul class="itemize" style="list-style-type: '̂e Ê'">
+<ul class="itemize" style="list-style-type: 'ê Ê'">
 <li>item e ê <small class="sc">Ê</small>
 </li></ul>
 
-<ul class="itemize" style="list-style-type: '̂E Ê'">
+<ul class="itemize" style="list-style-type: 'Ê Ê'">
 <li>item E Ê <small class="sc">Ê</small>
 </li></ul>
 
diff --git a/tp/t/results/invalid_nestings/section_on_itemize_line.pl 
b/tp/t/results/invalid_nestings/section_on_itemize_line.pl
index b464a7a49d..bc5b07ef44 100644
--- a/tp/t/results/invalid_nestings/section_on_itemize_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_itemize_line.pl
@@ -204,17 +204,16 @@ $result_trees{'section_on_itemize_line'} = {
               'contents' => [
                 {
                   'cmdname' => 'ringaccent',
+                  'info' => {
+                    'spaces_after_cmd_before_arg' => ' '
+                  },
                   'source_info' => {
                     'file_name' => '',
                     'line_nr' => 7,
                     'macro' => ''
-                  },
-                  'type' => 'command_as_argument'
+                  }
                 }
               ],
-              'info' => {
-                'spaces_after_argument' => ' '
-              },
               'type' => 'block_line_arg'
             }
           ],
@@ -426,30 +425,30 @@ $result_errors{'section_on_itemize_line'} = [
     'type' => 'error'
   },
   {
-    'error_line' => 'warning: @section should only appear at the beginning of 
a line
+    'error_line' => '@ringaccent expected braces
 ',
     'file_name' => '',
     'line_nr' => 7,
     'macro' => '',
-    'text' => '@section should only appear at the beginning of a line',
-    'type' => 'warning'
+    'text' => '@ringaccent expected braces',
+    'type' => 'error'
   },
   {
-    'error_line' => 'warning: @section should not appear in @itemize
+    'error_line' => 'warning: @section should only appear at the beginning of 
a line
 ',
     'file_name' => '',
     'line_nr' => 7,
     'macro' => '',
-    'text' => '@section should not appear in @itemize',
+    'text' => '@section should only appear at the beginning of a line',
     'type' => 'warning'
   },
   {
-    'error_line' => 'warning: accent command `@ringaccent\' not allowed as 
@itemize argument
+    'error_line' => 'warning: @section should not appear in @itemize
 ',
     'file_name' => '',
     'line_nr' => 7,
     'macro' => '',
-    'text' => 'accent command `@ringaccent\' not allowed as @itemize argument',
+    'text' => '@section should not appear in @itemize',
     'type' => 'warning'
   },
   {
@@ -494,7 +493,7 @@ $result_converted{'xml'}->{'section_on_itemize_line'} = 
'<itemize commandarg="mi
 </section>
 <section spaces=" "><sectiontitle>third</sectiontitle>
 
-<itemize spaces=" "><itemprepend><accent type="ring"></accent> 
</itemprepend></itemize>
+<itemize spaces=" "><itemprepend><accent 
type="ring"></accent></itemprepend></itemize>
 </section>
 <section spaces=" "><sectiontitle>fourth</sectiontitle>
 </section>
diff --git a/tp/t/results/invalid_nestings/section_on_xtable_line.pl 
b/tp/t/results/invalid_nestings/section_on_xtable_line.pl
index fe00fe6f11..a64bed440e 100644
--- a/tp/t/results/invalid_nestings/section_on_xtable_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_xtable_line.pl
@@ -201,17 +201,16 @@ $result_trees{'section_on_xtable_line'} = {
               'contents' => [
                 {
                   'cmdname' => 'ringaccent',
+                  'info' => {
+                    'spaces_after_cmd_before_arg' => ' '
+                  },
                   'source_info' => {
                     'file_name' => '',
                     'line_nr' => 7,
                     'macro' => ''
-                  },
-                  'type' => 'command_as_argument'
+                  }
                 }
               ],
-              'info' => {
-                'spaces_after_argument' => ' '
-              },
               'type' => 'block_line_arg'
             }
           ],
@@ -445,6 +444,15 @@ $result_errors{'section_on_xtable_line'} = [
     'text' => '@section seen before @end table',
     'type' => 'error'
   },
+  {
+    'error_line' => '@ringaccent expected braces
+',
+    'file_name' => '',
+    'line_nr' => 7,
+    'macro' => '',
+    'text' => '@ringaccent expected braces',
+    'type' => 'error'
+  },
   {
     'error_line' => 'warning: @section should only appear at the beginning of 
a line
 ',
@@ -464,13 +472,13 @@ $result_errors{'section_on_xtable_line'} = [
     'type' => 'warning'
   },
   {
-    'error_line' => 'warning: accent command `@ringaccent\' not allowed as 
@ftable argument
+    'error_line' => 'ftable requires an argument: the formatter for @item
 ',
     'file_name' => '',
     'line_nr' => 7,
     'macro' => '',
-    'text' => 'accent command `@ringaccent\' not allowed as @ftable argument',
-    'type' => 'warning'
+    'text' => 'ftable requires an argument: the formatter for @item',
+    'type' => 'error'
   },
   {
     'error_line' => '@section seen before @end ftable
@@ -514,7 +522,7 @@ $result_converted{'xml'}->{'section_on_xtable_line'} = 
'<vtable commandarg="asis
 </section>
 <section spaces=" "><sectiontitle>third</sectiontitle>
 
-<ftable commandarg="asis" spaces=" "> </ftable>
+<ftable commandarg="asis" spaces=" "></ftable>
 </section>
 <section spaces=" "><sectiontitle>fourth</sectiontitle>
 </section>
diff --git a/tp/t/results/itemize/accent_argument.pl 
b/tp/t/results/itemize/accent_argument.pl
index 9ac24401ac..369410fceb 100644
--- a/tp/t/results/itemize/accent_argument.pl
+++ b/tp/t/results/itemize/accent_argument.pl
@@ -14,15 +14,22 @@ $result_trees{'accent_argument'} = {
             {
               'contents' => [
                 {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'e'
+                        }
+                      ],
+                      'type' => 'following_arg'
+                    }
+                  ],
                   'cmdname' => '~',
                   'source_info' => {
                     'file_name' => '',
                     'line_nr' => 1,
                     'macro' => ''
                   }
-                },
-                {
-                  'text' => 'e'
                 }
               ],
               'info' => {
@@ -228,13 +235,13 @@ $result_floats{'accent_argument'} = {};
 
 
 
-$result_converted{'plaintext'}->{'accent_argument'} = '   ̃e item
+$result_converted{'plaintext'}->{'accent_argument'} = '   ẽ item
 
    ẽ item
 ';
 
 
-$result_converted{'html_text'}->{'accent_argument'} = '<ul class="itemize" 
style="list-style-type: \'\\0303 e\'">
+$result_converted{'html_text'}->{'accent_argument'} = '<ul class="itemize" 
style="list-style-type: \'\\1EBD \'">
 <li>item
 </li></ul>
 
@@ -244,8 +251,8 @@ $result_converted{'html_text'}->{'accent_argument'} = '<ul 
class="itemize" style
 ';
 
 
-$result_converted{'xml'}->{'accent_argument'} = '<itemize spaces=" " 
endspaces=" "><itemprepend><accent type="tilde"></accent>e</itemprepend>
-<listitem><prepend><accent type="tilde"></accent>e</prepend> <para>item
+$result_converted{'xml'}->{'accent_argument'} = '<itemize spaces=" " 
endspaces=" "><itemprepend><accent type="tilde" 
bracketed="off">e</accent></itemprepend>
+<listitem><prepend><accent type="tilde" bracketed="off">e</accent></prepend> 
<para>item
 </para></listitem></itemize>
 
 <itemize spaces=" " endspaces=" "><itemprepend><accent 
type="tilde">e</accent></itemprepend>
diff --git a/tp/t/results/itemize/empty_accent_argument.pl 
b/tp/t/results/itemize/empty_accent_argument.pl
index bc28eb86f3..709ad376c4 100644
--- a/tp/t/results/itemize/empty_accent_argument.pl
+++ b/tp/t/results/itemize/empty_accent_argument.pl
@@ -19,8 +19,7 @@ $result_trees{'empty_accent_argument'} = {
                     'file_name' => '',
                     'line_nr' => 1,
                     'macro' => ''
-                  },
-                  'type' => 'command_as_argument'
+                  }
                 }
               ],
               'info' => {
@@ -125,8 +124,7 @@ $result_trees{'empty_accent_argument'} = {
                     'file_name' => '',
                     'line_nr' => 5,
                     'macro' => ''
-                  },
-                  'type' => 'command_as_argument'
+                  }
                 }
               ],
               'info' => {
@@ -329,21 +327,21 @@ item
 
 $result_errors{'empty_accent_argument'} = [
   {
-    'error_line' => 'warning: accent command `@~\' not allowed as @itemize 
argument
+    'error_line' => '@~ expected braces
 ',
     'file_name' => '',
     'line_nr' => 1,
     'macro' => '',
-    'text' => 'accent command `@~\' not allowed as @itemize argument',
-    'type' => 'warning'
+    'text' => '@~ expected braces',
+    'type' => 'error'
   },
   {
-    'error_line' => 'warning: accent command `@~\' not allowed as @itemize 
argument
+    'error_line' => 'warning: command `@~\' must not be followed by new line
 ',
     'file_name' => '',
     'line_nr' => 5,
     'macro' => '',
-    'text' => 'accent command `@~\' not allowed as @itemize argument',
+    'text' => 'command `@~\' must not be followed by new line',
     'type' => 'warning'
   },
   {
diff --git a/tp/t/results/xtable/accent_on_table_line.pl 
b/tp/t/results/xtable/accent_on_table_line.pl
index 3f6e34efd4..b8200de6c4 100644
--- a/tp/t/results/xtable/accent_on_table_line.pl
+++ b/tp/t/results/xtable/accent_on_table_line.pl
@@ -23,8 +23,7 @@ $result_trees{'accent_on_table_line'} = {
                     'file_name' => '',
                     'line_nr' => 1,
                     'macro' => ''
-                  },
-                  'type' => 'command_as_argument'
+                  }
                 }
               ],
               'info' => {
@@ -361,14 +360,23 @@ no at-command code acc brace
 
 $result_errors{'accent_on_table_line'} = [
   {
-    'error_line' => 'warning: accent command `@~\' not allowed as @table 
argument
+    'error_line' => 'warning: command `@~\' must not be followed by new line
 ',
     'file_name' => '',
     'line_nr' => 1,
     'macro' => '',
-    'text' => 'accent command `@~\' not allowed as @table argument',
+    'text' => 'command `@~\' must not be followed by new line',
     'type' => 'warning'
   },
+  {
+    'error_line' => 'table requires an argument: the formatter for @item
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'table requires an argument: the formatter for @item',
+    'type' => 'error'
+  },
   {
     'error_line' => 'warning: accent command `@~\' not allowed as @table 
argument
 ',



reply via email to

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