texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Parser.pm Texinfo/Struc...
Date: Mon, 25 Oct 2010 22:09:07 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        10/10/25 22:09:07

Modified files:
        tp             : TODO 
        tp/Texinfo     : Parser.pm Structuring.pm 
        tp/t           : 16raw.t test_utils.pl 
        tp/t/results/invalid_nestings: in_table.pl 
Added files:
        tp/t/results/raw: raw_in_brace_command.pl 

Log message:
        Don't warn for raw format block commands in brace commands, but
        warn for invalid commands on @item and @itemx.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/16raw.t?cvsroot=texinfo&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/test_utils.pl?cvsroot=texinfo&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/in_table.pl?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/raw/raw_in_brace_command.pl?cvsroot=texinfo&rev=1.1

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- TODO        24 Oct 2010 22:52:52 -0000      1.42
+++ TODO        25 Oct 2010 22:09:06 -0000      1.43
@@ -15,8 +15,6 @@
 
 test empty line in block or brace command in menu description.
 
-in t/57invalid_nestings.t in_table, no warning for bad stuff on @item line.
-
 in hyphenation: only text and accent commands, and should
 only appear in toplevel
 
@@ -32,7 +30,6 @@
 no warning in
 t/19def.t empty_def_arguments
 
-
 Texinfo::Convert::Text
 @c in menu lines (and maybe at other places) should be replaced by 
 \n and not eat the end of line.

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- Texinfo/Parser.pm   25 Oct 2010 19:37:07 -0000      1.112
+++ Texinfo/Parser.pm   25 Oct 2010 22:09:06 -0000      1.113
@@ -149,7 +149,7 @@
 # skipspace:   no argument, following spaces are skipped.
 # noarg:       no argument
 # text:        the line is parsed as texinfo, and the argument is converted
-#              to simple text
+#              to simple text (in _end_line)
 # line:        the line is parsed as texinfo
 # a number:    the line is parsed as texinfo and the result should be plain 
 #              text maybe followed by a comment; the result is analysed
@@ -326,7 +326,6 @@
 };
 
 
-
 # commands delimiting blocks, with an @end.
 # Value is either the number of arguments on the line separated by
 # commas or the type of command, 'raw', 'def' or 'multitable'.
@@ -338,6 +337,7 @@
 # commands that forces closing an opened paragraph.
 my %close_paragraph_commands;
 
+# currently not used
 # the type of index, f: function, v: variable, t: type
 my %index_type_def = (
  'f' => ['deffn', 'deftypefn', 'deftypeop', 'defop'],
@@ -352,6 +352,7 @@
   }
 }
 
+
 my %def_map = (
     # basic commands. 
     # 'arg' and 'argtype' are for everything appearing after the other
@@ -608,6 +609,10 @@
                                        'indent', 'columnfractions') {
   $in_full_text_commands{$misc_command_in_full_text} = 1;
 }
+
+foreach my $out_format (@out_formats) {
+  $in_full_text_commands{$out_format} = 1;
+}
 delete $in_full_text_commands{'caption'};
 delete $in_full_text_commands{'shortcaption'};
 foreach my $block_command (keys(%block_commands)) {
@@ -2443,7 +2448,9 @@
                                and $current->{'type'} eq 'block_line_arg')
                            or ($current->{'type'} 
                                and $current->{'type'} eq 'misc_line_arg'
-                               and 
$root_commands{$current->{'parent'}->{'cmdname'}})))
+                               and 
($root_commands{$current->{'parent'}->{'cmdname'}}
+                                    or $current->{'parent'}->{'cmdname'} eq 
'itemx'
+                                    or $current->{'parent'}->{'cmdname'} eq 
'item'))))
                      or ($full_text_commands{$current->{'parent'}->{'cmdname'}}
                       and !$in_full_text_commands{$command})) {
               _line_warn($self, sprintf($self->__("address@hidden should not 
appear in address@hidden"), 

Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Texinfo/Structuring.pm      25 Oct 2010 19:48:44 -0000      1.4
+++ Texinfo/Structuring.pm      25 Oct 2010 22:09:06 -0000      1.5
@@ -113,7 +113,7 @@
 }
 
 # the tree is modified: 'next' pointers are added.
-sub collect_structure($)
+sub _collect_structure($)
 {
   my $current = shift;
 
@@ -135,4 +135,23 @@
   }
 }
 
+sub sectioning_structure($)
+{
+  my $root = shift;
+  if (!$root->{'type'} or $root->{'type'} ne 'document_root'
+      or !$root->{'contents'}) {
+    return undef;
+  }
+  foreach my $content (@{$root->{'contents'}}) {
+    if ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
+        and $content->{'cmdname'} ne 'bye') {
+      my $level = 0;
+      $level = $content->{'extra'}->{'sections_level'}
+        if ($content->{'extra'} and $content->{'extra'}->{'sections_level'});
+
+      print STDERR "$level $content->{'cmdname'}\n";
+    }
+  }
+}
+
 1;

Index: t/16raw.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/16raw.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- t/16raw.t   24 Oct 2010 10:14:49 -0000      1.10
+++ t/16raw.t   25 Oct 2010 22:09:06 -0000      1.11
@@ -75,6 +75,19 @@
 
 @macro
 
+'],
+['raw_in_brace_command',
+'@code{
address@hidden
+in html
address@hidden html
+}
+
address@hidden
address@hidden
+in verbatim
address@hidden verbatim
+}
 ']
 );
 

Index: t/test_utils.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/test_utils.pl,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- t/test_utils.pl     24 Oct 2010 19:23:40 -0000      1.24
+++ t/test_utils.pl     25 Oct 2010 22:09:07 -0000      1.25
@@ -81,6 +81,7 @@
   }
 #use Texinfo::Structuring;
 #Texinfo::Structuring::collect_structure($result);
+#Texinfo::Structuring::sectioning_structure($result);
 
   my ($errors, $error_nrs) = $parser->errors();
   my ($index_names, $merged_indices) = $parser->indices_information();

Index: t/results/invalid_nestings/in_table.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/invalid_nestings/in_table.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- t/results/invalid_nestings/in_table.pl      25 Oct 2010 19:26:49 -0000      
1.3
+++ t/results/invalid_nestings/in_table.pl      25 Oct 2010 22:09:07 -0000      
1.4
@@ -309,6 +309,42 @@
     'type' => 'warning'
   },
   {
+    'error_line' => ':5: warning: @indent should not appear in @item
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@indent should not appear in @item',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => ':5: warning: @titlefont should not appear in @item
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@titlefont should not appear in @item',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => ':5: warning: @anchor should not appear in @item
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@anchor should not appear in @item',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => ':5: warning: @footnote should not appear in @item
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@footnote should not appear in @item',
+    'type' => 'warning'
+  },
+  {
     'error_line' => ':5: warning: @exdent should only appear at a line 
beginning
 ',
     'file_name' => '',
@@ -316,6 +352,15 @@
     'macro' => '',
     'text' => '@exdent should only appear at a line beginning',
     'type' => 'warning'
+  },
+  {
+    'error_line' => ':5: warning: @exdent should not appear in @item
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@exdent should not appear in @item',
+    'type' => 'warning'
   }
 ];
 

Index: t/results/raw/raw_in_brace_command.pl
===================================================================
RCS file: t/results/raw/raw_in_brace_command.pl
diff -N t/results/raw/raw_in_brace_command.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/raw/raw_in_brace_command.pl       25 Oct 2010 22:09:07 -0000      
1.1
@@ -0,0 +1,196 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
%results_indices);
+
+$result_trees{'raw_in_brace_command'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => '
+'
+                },
+                {
+                  'cmdname' => 'html',
+                  'contents' => [
+                    {
+                      'parent' => {},
+                      'text' => '
+',
+                      'type' => 'empty_line_after_command'
+                    },
+                    {
+                      'parent' => {},
+                      'text' => 'in html
+',
+                      'type' => 'raw'
+                    }
+                  ],
+                  'parent' => {}
+                },
+                {
+                  'parent' => {},
+                  'text' => '
+',
+                  'type' => 'empty_line_after_command'
+                }
+              ],
+              'parent' => {},
+              'type' => 'brace_command_arg'
+            }
+          ],
+          'cmdname' => 'code',
+          'contents' => [],
+          'parent' => {}
+        },
+        {
+          'parent' => {},
+          'text' => '
+'
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    },
+    {
+      'parent' => {},
+      'text' => '
+',
+      'type' => 'empty_line'
+    },
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => '
+'
+                }
+              ],
+              'parent' => {},
+              'type' => 'brace_command_arg'
+            }
+          ],
+          'cmdname' => 'samp',
+          'contents' => [],
+          'parent' => {}
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    },
+    {
+      'cmdname' => 'verbatim',
+      'contents' => [
+        {
+          'parent' => {},
+          'text' => '
+',
+          'type' => 'empty_line_after_command'
+        },
+        {
+          'parent' => {},
+          'text' => 'in verbatim
+',
+          'type' => 'raw'
+        }
+      ],
+      'parent' => {}
+    },
+    {
+      'parent' => {},
+      'text' => '
+',
+      'type' => 'empty_line_after_command'
+    },
+    {
+      'parent' => {},
+      'text' => '
+'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[1]{'contents'}[0]{'parent'}
 = 
$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[1];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[1]{'contents'}[1]{'parent'}
 = 
$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[1];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[1]{'parent'}
 = 
$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[2]{'parent'}
 = 
$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[0]{'parent'} 
= $result_trees{'raw_in_brace_command'}{'contents'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'contents'}[1]{'parent'} 
= $result_trees{'raw_in_brace_command'}{'contents'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[0]{'parent'} = 
$result_trees{'raw_in_brace_command'};
+$result_trees{'raw_in_brace_command'}{'contents'}[1]{'parent'} = 
$result_trees{'raw_in_brace_command'};
+$result_trees{'raw_in_brace_command'}{'contents'}[2]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'raw_in_brace_command'}{'contents'}[2]{'contents'}[0]{'args'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[2]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'raw_in_brace_command'}{'contents'}[2]{'contents'}[0];
+$result_trees{'raw_in_brace_command'}{'contents'}[2]{'contents'}[0]{'parent'} 
= $result_trees{'raw_in_brace_command'}{'contents'}[2];
+$result_trees{'raw_in_brace_command'}{'contents'}[2]{'parent'} = 
$result_trees{'raw_in_brace_command'};
+$result_trees{'raw_in_brace_command'}{'contents'}[3]{'contents'}[0]{'parent'} 
= $result_trees{'raw_in_brace_command'}{'contents'}[3];
+$result_trees{'raw_in_brace_command'}{'contents'}[3]{'contents'}[1]{'parent'} 
= $result_trees{'raw_in_brace_command'}{'contents'}[3];
+$result_trees{'raw_in_brace_command'}{'contents'}[3]{'parent'} = 
$result_trees{'raw_in_brace_command'};
+$result_trees{'raw_in_brace_command'}{'contents'}[4]{'parent'} = 
$result_trees{'raw_in_brace_command'};
+$result_trees{'raw_in_brace_command'}{'contents'}[5]{'parent'} = 
$result_trees{'raw_in_brace_command'};
+
+$result_texis{'raw_in_brace_command'} = '@code{
address@hidden
+in html
address@hidden html
+}
+
address@hidden
address@hidden
+in verbatim
address@hidden verbatim
+
+';
+
+
+$result_texts{'raw_in_brace_command'} = '
+
+
+
+in verbatim
+
+';
+
+$result_errors{'raw_in_brace_command'} = [
+  {
+    'error_line' => ':8: warning: @verbatim should not appear in @samp
+',
+    'file_name' => '',
+    'line_nr' => 8,
+    'macro' => '',
+    'text' => '@verbatim should not appear in @samp',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => ':8: @samp missing close brace
+',
+    'file_name' => '',
+    'line_nr' => 8,
+    'macro' => '',
+    'text' => '@samp missing close brace',
+    'type' => 'error'
+  },
+  {
+    'error_line' => ':11: Misplaced }
+',
+    'file_name' => '',
+    'line_nr' => 11,
+    'macro' => '',
+    'text' => 'Misplaced }',
+    'type' => 'error'
+  }
+];
+
+
+$result_indices{'raw_in_brace_command'} = undef;
+
+
+1;



reply via email to

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