texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp DebugTexinfo/DebugTree.pm Texinfo/Co...


From: Patrice Dumas
Subject: texinfo/tp DebugTexinfo/DebugTree.pm Texinfo/Co...
Date: Thu, 20 Oct 2011 20:51:08 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/10/20 20:51:08

Modified files:
        tp/DebugTexinfo: DebugTree.pm 
        tp/Texinfo     : Common.pm Parser.pm 
        tp/Texinfo/Convert: Plaintext.pm 
        tp/t/results/invalid_nestings: center.pl in_table.pl 

Log message:
        Add a category of commands for line commands that accept
        most of the constructs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/DebugTexinfo/DebugTree.pm?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.317&r2=1.318
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.174&r2=1.175
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/center.pl?cvsroot=texinfo&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/in_table.pl?cvsroot=texinfo&r1=1.41&r2=1.42

Patches:
Index: DebugTexinfo/DebugTree.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/DebugTexinfo/DebugTree.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- DebugTexinfo/DebugTree.pm   15 Oct 2011 12:01:43 -0000      1.3
+++ DebugTexinfo/DebugTree.pm   20 Oct 2011 20:51:07 -0000      1.4
@@ -34,19 +34,21 @@
   my $self = shift;
   my $root = shift;
   my $elements;
+  my $pages;
+  if ($self) {
   if ($self->get_conf('USE_NODES')) {
     $elements = Texinfo::Structuring::split_by_node($root);
   } elsif (defined($self->get_conf('USE_NODES'))) {
     #print STDERR "U sections\n";
     $elements = Texinfo::Structuring::split_by_section($root);
   }
-  my $pages;
   if ($elements and ($self->get_conf('SPLIT') 
                      or !$self->get_conf('MONOLITHIC'))) {
     #print STDERR "S ".$self->get_conf('SPLIT')."\n";
     $pages = Texinfo::Structuring::split_pages($elements,
                                                $self->get_conf('SPLIT'));
   }
+  }
   if ($pages) {
     #print STDERR "PPP $pages\n";
     $root = {'type' => 'pages_root',
@@ -55,7 +57,7 @@
     $root = {'type' => 'elements_root',
              'contents' => $elements };
   }
-  return $self->_print_tree($root);
+  return _print_tree($self, $root);
 }
 
 sub _print_tree($$;$$);
@@ -87,12 +89,12 @@
   print $result ."\n";
   if ($root->{'args'}) {
     foreach my $arg (@{$root->{'args'}}) {
-      $self->_print_tree ($arg, $level +1, 1);
+      _print_tree ($self, $arg, $level +1, 1);
     }
   }
   if ($root->{'contents'}) {
     foreach my $content (@{$root->{'contents'}}) {
-      $self->_print_tree ($content, $level+1);
+      _print_tree ($self, $content, $level+1);
     }
   }
 }

Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- Texinfo/Common.pm   11 Oct 2011 22:41:53 -0000      1.76
+++ Texinfo/Common.pm   20 Oct 2011 20:51:07 -0000      1.77
@@ -309,7 +309,7 @@
   'exdent'            => 'line',
   'headitem'          => 'skipspace',
   'item'              => 'skipspace', # or line, depending on the context
-  'itemx'             => 'skipspace',
+  'itemx'             => 'skipspace', # or line, depending on the context
   'tab'               => 'skipspace', 
   # only valid in heading or footing
   'thischapter'       => 'noarg',

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.317
retrieving revision 1.318
diff -u -b -r1.317 -r1.318
--- Texinfo/Parser.pm   15 Oct 2011 21:31:07 -0000      1.317
+++ Texinfo/Parser.pm   20 Oct 2011 20:51:07 -0000      1.318
@@ -407,10 +407,16 @@
     if ($block_commands{$block_command} eq 'conditional');
 }
 
+# commands that may happen on lines where everything is
+# permitted
+my %in_full_line_commands = %in_full_text_commands;
+foreach my $not_in_full_line_commands('noindent', 'indent') {
+  delete $in_full_line_commands{$not_in_full_line_commands};
+}
+
 # commands that may happen in simple text arguments
-my %in_simple_text_commands = %in_full_text_commands;
-foreach my $not_in_simple_text_command('noindent', 'indent', 
-                                       'titlefont', 'anchor', 'footnote',
+my %in_simple_text_commands = %in_full_line_commands;
+foreach my $not_in_simple_text_command('titlefont', 'anchor', 'footnote',
                                        'xref','ref','pxref', 'inforef') {
   delete $in_simple_text_commands{$not_in_simple_text_command};
 }
@@ -443,8 +449,12 @@
     $full_text_commands{$brace_command} = 1;
   }
 }
-$full_text_commands{'center'} = 1;
-$full_text_commands{'exdent'} = 1;
+
+# commands that accept almost the same than in full text, except
+# what do not make sense on a line.
+my %full_line_commands;
+$full_line_commands{'center'} = 1;
+$full_line_commands{'exdent'} = 1;
 
 # contexts on the context_stack stack where empty line don't trigger
 # paragraph
@@ -3726,9 +3736,13 @@
                                and $current->{'type'} eq 'block_line_arg')
                            or ($current->{'type'} 
                                and $current->{'type'} eq 'misc_line_arg'
-                               and 
($root_commands{$current->{'parent'}->{'cmdname'}}
-                                    or $current->{'parent'}->{'cmdname'} eq 
'itemx'
-                                    or $current->{'parent'}->{'cmdname'} eq 
'item'))))
+                               and 
($root_commands{$current->{'parent'}->{'cmdname'}}))))
+                     or 
(($full_line_commands{$current->{'parent'}->{'cmdname'}}
+                          or ($current->{'type'}
+                              and $current->{'type'} eq 'misc_line_arg'
+                              and ($current->{'parent'}->{'cmdname'} eq 'itemx'
+                                   or $current->{'parent'}->{'cmdname'} eq 
'item')))
+                      and !$in_full_line_commands{$command})
                      or ($full_text_commands{$current->{'parent'}->{'cmdname'}}
                       and !$in_full_text_commands{$command})) {
               $self->line_warn (sprintf($self->__("address@hidden should not 
appear in address@hidden"), 

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- Texinfo/Convert/Plaintext.pm        18 Oct 2011 23:16:15 -0000      1.174
+++ Texinfo/Convert/Plaintext.pm        20 Oct 2011 20:51:07 -0000      1.175
@@ -1766,14 +1766,16 @@
           if ($command_as_argument->{'type'} ne 'definfoenclose_command') {
             $contents = [{'cmdname' => $command_as_argument->{'cmdname'},
                      'args' => [{'type' => 'brace_command_arg', 
-                                'contents' => $contents}]
+                                'contents' => $contents}],
+                     'line_nr' => $root->{'line_nr'},
             }];
           } else {
             $contents = [{'cmdname' => $command_as_argument->{'cmdname'},
                           'type' => $command_as_argument->{'type'},
                           'extra' => $command_as_argument->{'extra'},
                      'args' => [{'type' => 'brace_command_arg', 
-                                'contents' => $contents}]
+                                'contents' => $contents}],
+                     'line_nr' => $root->{'line_nr'},
             }];
           }
         }

Index: t/results/invalid_nestings/center.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/invalid_nestings/center.pl,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- t/results/invalid_nestings/center.pl        15 Oct 2011 16:11:15 -0000      
1.43
+++ t/results/invalid_nestings/center.pl        20 Oct 2011 20:51:08 -0000      
1.44
@@ -21,6 +21,9 @@
             },
             {
               'cmdname' => 'indent',
+              'extra' => {
+                'invalid_nesting' => 1
+              },
               'line_nr' => {
                 'file_name' => '',
                 'line_nr' => 1,
@@ -2137,6 +2140,15 @@
 
 $result_errors{'center'} = [
   {
+    'error_line' => ':1: warning: @indent should not appear in @center
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => '@indent should not appear in @center',
+    'type' => 'warning'
+  },
+  {
     'error_line' => ':3: warning: @cindex should only appear at a line 
beginning
 ',
     'file_name' => '',

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.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- t/results/invalid_nestings/in_table.pl      4 Sep 2011 12:14:05 -0000       
1.41
+++ t/results/invalid_nestings/in_table.pl      20 Oct 2011 20:51:08 -0000      
1.42
@@ -237,8 +237,7 @@
                                   [
                                     {}
                                   ]
-                                ],
-                                'invalid_nesting' => 1
+                                ]
                               },
                               'line_nr' => {},
                               'parent' => {}
@@ -268,7 +267,6 @@
                                     {}
                                   ]
                                 ],
-                                'invalid_nesting' => 1,
                                 'node_content' => [
                                   {}
                                 ],
@@ -298,9 +296,6 @@
                               ],
                               'cmdname' => 'footnote',
                               'contents' => [],
-                              'extra' => {
-                                'invalid_nesting' => 1
-                              },
                               'line_nr' => {},
                               'parent' => {}
                             },
@@ -481,8 +476,7 @@
                                     {}
                                   ],
                                   undef
-                                ],
-                                'invalid_nesting' => 1
+                                ]
                               },
                               'line_nr' => {
                                 'file_name' => '',
@@ -1602,33 +1596,6 @@
     'type' => 'warning'
   },
   {
-    'error_line' => ':8: warning: @titlefont should not appear in @item
-',
-    'file_name' => '',
-    'line_nr' => 8,
-    'macro' => '',
-    'text' => '@titlefont should not appear in @item',
-    'type' => 'warning'
-  },
-  {
-    'error_line' => ':8: warning: @anchor should not appear in @item
-',
-    'file_name' => '',
-    'line_nr' => 8,
-    'macro' => '',
-    'text' => '@anchor should not appear in @item',
-    'type' => 'warning'
-  },
-  {
-    'error_line' => ':8: warning: @footnote should not appear in @item
-',
-    'file_name' => '',
-    'line_nr' => 8,
-    'macro' => '',
-    'text' => '@footnote should not appear in @item',
-    'type' => 'warning'
-  },
-  {
     'error_line' => ':8: warning: @exdent should only appear at a line 
beginning
 ',
     'file_name' => '',
@@ -1647,15 +1614,6 @@
     'type' => 'warning'
   },
   {
-    'error_line' => ':10: warning: @ref should not appear in @item
-',
-    'file_name' => '',
-    'line_nr' => 10,
-    'macro' => '',
-    'text' => '@ref should not appear in @item',
-    'type' => 'warning'
-  },
-  {
     'error_line' => ':10: @ref missing close brace
 ',
     'file_name' => '',



reply via email to

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