texinfo-commits
[Top][All Lists]
Advanced

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

[8347] warning for unbraced prototype


From: gavinsmith0123
Subject: [8347] warning for unbraced prototype
Date: Sat, 20 Oct 2018 05:36:13 -0400 (EDT)

Revision: 8347
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8347
Author:   gavin
Date:     2018-10-20 05:36:12 -0400 (Sat, 20 Oct 2018)
Log Message:
-----------
warning for unbraced prototype

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Parser.pm
    trunk/tp/Texinfo/XS/parsetexi/end_line.c
    trunk/tp/Texinfo/XS/parsetexi/tree.c
    trunk/tp/t/results/invalid_nestings/on_block_command_line.pl
    trunk/tp/t/results/multitable/prototype_no_brace.pl
    trunk/tp/t/results/xml_tests/commands_and_spaces.pl

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2018-10-20 09:03:49 UTC (rev 8346)
+++ trunk/ChangeLog     2018-10-20 09:36:12 UTC (rev 8347)
@@ -1,3 +1,9 @@
+2018-10-20  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Parser.pm (_end_line) <@multitable>: Give a warning 
+       messaage for any @-command appearing on the multitable line 
+       outside of a braced prototype.
+
 2018-10-19  Gavin Smith  <address@hidden>
 
        * tp/tests/sectioning/list-of-tests: Do not run every test

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2018-10-20 09:03:49 UTC (rev 8346)
+++ trunk/tp/Texinfo/Parser.pm  2018-10-20 09:36:12 UTC (rev 8347)
@@ -2732,6 +2732,9 @@
           push @prototype_row, { 'contents' => $content->{'contents'},
                                  'type' => 'bracketed_multitable_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
+          # Texinfo manual.
           if ($content->{'text'} =~ /\S/) {
             foreach my $prototype (split /\s+/, $content->{'text'}) {
               push @prototype_row, { 'text' => $prototype, 
@@ -2739,16 +2742,13 @@
             }
           }
         } else {
-          # FIXME could this happen?  Should be a debug message?
-          if (!$content->{'cmdname'}) { 
+          if (!$content->{'cmdname'}
+                or ($content->{'cmdname'} ne 'c'
+                    and $content->{'cmdname'} ne 'comment')) {
             $self->_command_warn($current, $line_nr, 
                 __("unexpected argument on address@hidden line: %s"),
-                   $current->{'cmdname'}, 
-         Texinfo::Convert::Texinfo::convert({ $content->{'contents'} }));
-          } elsif ($content->{'cmdname'} eq 'c' 
-                   or $content->{'cmdname'} eq 'comment') {
-          } else {
-            push @prototype_row, $content;
+                     $current->{'parent'}->{'cmdname'}, 
+                     Texinfo::Convert::Texinfo::convert($content));
           }
         }
       }
@@ -2760,10 +2760,8 @@
                              __("empty multitable"));
       }
       $multitable->{'extra'}->{'prototypes'} = address@hidden;
-      _isolate_last_space($self, $current);
-    } else {
-      _isolate_last_space($self, $current);
-    } 
+    }
+    _isolate_last_space($self, $current);
     $current = $current->{'parent'};
     delete $current->{'remaining_args'};
     # don't consider empty argument of block @-commands as argument,

Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-10-20 09:03:49 UTC (rev 
8346)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-10-20 09:36:12 UTC (rev 
8347)
@@ -1050,11 +1050,15 @@
             }
           else // 2913
             {
-              if (!e->cmd)
+              if (e->cmd != CM_c && e->cmd != CM_comment)
                 {
-                  command_warn (current, "unexpected argument on @%s line:",
-                                command_name(current->cmd));
-                  // TODO: Convert argument to Texinfo
+                  char *texi;
+                  texi = convert_to_texinfo (e);
+                  command_warn (current,
+                                "unexpected argument on @%s line: %s",
+                                command_name(current->parent->cmd),
+                                texi);
+                  free (texi);
                 }
             }
         }

Modified: trunk/tp/Texinfo/XS/parsetexi/tree.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/tree.c        2018-10-20 09:03:49 UTC (rev 
8346)
+++ trunk/tp/Texinfo/XS/parsetexi/tree.c        2018-10-20 09:36:12 UTC (rev 
8347)
@@ -73,7 +73,7 @@
         case extra_contents_oot:
           {
             /* Only used for 'prototypes' */
-            /* Destroy each element in the array, but not any children
+            /* Free each element in the array, but not any children
                of each element. */
             int j;
             ELEMENT *array = e->extra[i].value;

Modified: trunk/tp/t/results/invalid_nestings/on_block_command_line.pl
===================================================================
--- trunk/tp/t/results/invalid_nestings/on_block_command_line.pl        
2018-10-20 09:03:49 UTC (rev 8346)
+++ trunk/tp/t/results/invalid_nestings/on_block_command_line.pl        
2018-10-20 09:36:12 UTC (rev 8347)
@@ -167,13 +167,12 @@
       ],
       'extra' => {
         'end_command' => {},
-        'max_columns' => 2,
+        'max_columns' => 1,
         'prototypes' => [
           {
             'contents' => [],
             'type' => 'bracketed_multitable_prototype'
-          },
-          {}
+          }
         ],
         'spaces_before_argument' => ' '
       },
@@ -388,7 +387,6 @@
 $result_trees{'on_block_command_line'}{'contents'}[0]{'contents'}[1]{'parent'} 
= $result_trees{'on_block_command_line'}{'contents'}[0];
 $result_trees{'on_block_command_line'}{'contents'}[0]{'extra'}{'end_command'} 
= $result_trees{'on_block_command_line'}{'contents'}[0]{'contents'}[1];
 
$result_trees{'on_block_command_line'}{'contents'}[0]{'extra'}{'prototypes'}[0]{'contents'}
 = 
$result_trees{'on_block_command_line'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'contents'};
-$result_trees{'on_block_command_line'}{'contents'}[0]{'extra'}{'prototypes'}[1]
 = 
$result_trees{'on_block_command_line'}{'contents'}[0]{'args'}[0]{'contents'}[2];
 $result_trees{'on_block_command_line'}{'contents'}[0]{'line_nr'} = 
$result_trees{'on_block_command_line'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'contents'}[0]{'line_nr'};
 $result_trees{'on_block_command_line'}{'contents'}[0]{'parent'} = 
$result_trees{'on_block_command_line'};
 $result_trees{'on_block_command_line'}{'contents'}[1]{'parent'} = 
$result_trees{'on_block_command_line'};
@@ -448,6 +446,15 @@
     'type' => 'warning'
   },
   {
+    'error_line' => ':1: warning: unexpected argument on @multitable line: 
@titlefont{in titlefont}
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'unexpected argument on @multitable line: @titlefont{in 
titlefont}',
+    'type' => 'warning'
+  },
+  {
     'error_line' => ':5: warning: @indent should not appear in @quotation
 ',
     'file_name' => '',

Modified: trunk/tp/t/results/multitable/prototype_no_brace.pl
===================================================================
--- trunk/tp/t/results/multitable/prototype_no_brace.pl 2018-10-20 09:03:49 UTC 
(rev 8346)
+++ trunk/tp/t/results/multitable/prototype_no_brace.pl 2018-10-20 09:36:12 UTC 
(rev 8347)
@@ -85,13 +85,12 @@
       ],
       'extra' => {
         'end_command' => {},
-        'max_columns' => 4,
+        'max_columns' => 3,
         'prototypes' => [
           {
             'text' => 'aa',
             'type' => 'row_prototype'
           },
-          {},
           {
             'text' => 'b',
             'type' => 'row_prototype'
@@ -142,7 +141,6 @@
 
$result_trees{'prototype_no_brace'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'prototype_no_brace'}{'contents'}[0]{'contents'}[0];
 $result_trees{'prototype_no_brace'}{'contents'}[0]{'contents'}[0]{'parent'} = 
$result_trees{'prototype_no_brace'}{'contents'}[0];
 $result_trees{'prototype_no_brace'}{'contents'}[0]{'extra'}{'end_command'} = 
$result_trees{'prototype_no_brace'}{'contents'}[0]{'contents'}[0];
-$result_trees{'prototype_no_brace'}{'contents'}[0]{'extra'}{'prototypes'}[1] = 
$result_trees{'prototype_no_brace'}{'contents'}[0]{'args'}[0]{'contents'}[1];
 
$result_trees{'prototype_no_brace'}{'contents'}[0]{'extra'}{'prototypes_line'}[1]
 = $result_trees{'prototype_no_brace'}{'contents'}[0]{'args'}[0]{'contents'}[1];
 $result_trees{'prototype_no_brace'}{'contents'}[0]{'line_nr'} = 
$result_trees{'prototype_no_brace'}{'contents'}[0]{'args'}[0]{'contents'}[1]{'line_nr'};
 $result_trees{'prototype_no_brace'}{'contents'}[0]{'parent'} = 
$result_trees{'prototype_no_brace'};
@@ -154,7 +152,17 @@
 
 $result_texts{'prototype_no_brace'} = '';
 
-$result_errors{'prototype_no_brace'} = [];
+$result_errors{'prototype_no_brace'} = [
+  {
+    'error_line' => ':1: warning: unexpected argument on @multitable line: 
@var{FF}
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'unexpected argument on @multitable line: @var{FF}',
+    'type' => 'warning'
+  }
+];
 
 
 

Modified: trunk/tp/t/results/xml_tests/commands_and_spaces.pl
===================================================================
--- trunk/tp/t/results/xml_tests/commands_and_spaces.pl 2018-10-20 09:03:49 UTC 
(rev 8346)
+++ trunk/tp/t/results/xml_tests/commands_and_spaces.pl 2018-10-20 09:36:12 UTC 
(rev 8347)
@@ -1018,7 +1018,7 @@
           ],
           'extra' => {
             'end_command' => {},
-            'max_columns' => 6,
+            'max_columns' => 5,
             'prototypes' => [
               {
                 'contents' => [],
@@ -1028,7 +1028,6 @@
                 'contents' => [],
                 'type' => 'bracketed_multitable_prototype'
               },
-              {},
               {
                 'text' => 'gg',
                 'type' => 'row_prototype'
@@ -1947,7 +1946,6 @@
 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'end_command'}
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'contents'}[0];
 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'prototypes'}[0]{'contents'}
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'args'}[0]{'contents'}[0]{'contents'};
 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'prototypes'}[1]{'contents'}
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'args'}[0]{'contents'}[2]{'contents'};
-$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'prototypes'}[2]
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'args'}[0]{'contents'}[4];
 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'prototypes_line'}[0]
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'args'}[0]{'contents'}[0];
 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'prototypes_line'}[2]
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'args'}[0]{'contents'}[2];
 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'extra'}{'prototypes_line'}[4]
 = 
$result_trees{'commands_and_spaces'}{'contents'}[1]{'contents'}[27]{'args'}[0]{'contents'}[4];
@@ -2228,7 +2226,17 @@
   }
 };
 
-$result_errors{'commands_and_spaces'} = [];
+$result_errors{'commands_and_spaces'} = [
+  {
+    'error_line' => ':41: warning: unexpected argument on @multitable line: 
@var{cmd}
+',
+    'file_name' => '',
+    'line_nr' => 41,
+    'macro' => '',
+    'text' => 'unexpected argument on @multitable line: @var{cmd}',
+    'type' => 'warning'
+  }
+];
 
 
 $result_floats{'commands_and_spaces'} = {




reply via email to

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