texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Parser.pm Texinfo/Convert/Pl...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Parser.pm Texinfo/Convert/Pl...
Date: Sat, 04 Dec 2010 13:19:38 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        10/12/04 13:19:38

Modified files:
        tp/Texinfo     : Parser.pm 
        tp/Texinfo/Convert: Plaintext.pm 
        tp/t/results/invalid_nestings: recursive_copying.pl 

Log message:
        Error with nested @insertcopying in @copying.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.158&r2=1.159
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/invalid_nestings/recursive_copying.pl?cvsroot=texinfo&r1=1.7&r2=1.8

Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -b -r1.158 -r1.159
--- Texinfo/Parser.pm   3 Dec 2010 23:26:52 -0000       1.158
+++ Texinfo/Parser.pm   4 Dec 2010 13:19:38 -0000       1.159
@@ -2886,10 +2886,24 @@
           my $arg_spec = $self->{'misc_commands'}->{$command};
 
           if ($arg_spec eq 'noarg') {
+            my $ignored = 0;
+            if ($command eq 'insertcopying') {
+              my $parent = $current;
+              while ($parent) {
+                if ($parent->{'cmdname'} and $parent->{'cmdname'} eq 
'copying') {
+                  $self->_line_error (sprintf($self->__("address@hidden not 
allowed inside address@hidden' block"), $command, $parent->{'cmdname'}), 
$line_nr);
+                  $ignored = 1;
+                  last;
+                }
+                $parent = $parent->{'parent'};
+              }
+            }
+            unless ($ignored) {
             push @{$current->{'contents'}}, {'cmdname' => $command,
                                              'parent' => $current};
             $current->{'contents'}->[-1]->{'extra'}->{'invalid_nesting'} = 1 
               if ($invalid);
+            }
           # all the cases using the raw line
           } elsif ($arg_spec eq 'skipline' or $arg_spec eq 'lineraw'
                    or $arg_spec eq 'special') {

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- Texinfo/Convert/Plaintext.pm        4 Dec 2010 12:11:11 -0000       1.22
+++ Texinfo/Convert/Plaintext.pm        4 Dec 2010 13:19:38 -0000       1.23
@@ -68,8 +68,10 @@
   $informative_commands{$informative_command} = 1;
 }
 
+# printindex not handled in plain text output.
+#'printindex',
 foreach my $kept_command(keys (%informative_commands),
-  'verbatiminclude', 'insertcopying', 'printindex',
+  'verbatiminclude', 'insertcopying', 
   'listoffloats', 'dircategory', 
   'contents', 'shortcontents', 'summarycontents', 
   'author', 'shorttitle', 'shorttitlepage', 'settitle', 'subtitle',
@@ -523,7 +525,6 @@
   # verbatiminclude
   # sp
   # insertcopying
-  # printindex
   # listoffloats
   # dircategory
   # center
@@ -757,7 +758,6 @@
       $result .= $self->_convert($root->{'args'}->[0]) if ($root->{'args'});
       pop @{$self->{'context'}};
       return $result;
-     # could this be used otherwise?
     } elsif ($command eq 'titlefont') {
       $result = Texinfo::Convert::Text::heading({'level' => 0, 
            'cmdname' => 'titlefont'},
@@ -909,6 +909,8 @@
           push @{$self->{'formatters'}}, $preformatted;
         }
         $cell = 1;
+      } elsif ($root->{'cmdname'} eq 'insertcopying') {
+        # FIXME handle insertcopying
       } elsif ($root->{'cmdname'} eq 'listoffloats') {
         # FIXME handle listoffloats
       } elsif ($root->{'cmdname'} eq 'sp') {

Index: t/results/invalid_nestings/recursive_copying.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/invalid_nestings/recursive_copying.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- t/results/invalid_nestings/recursive_copying.pl     20 Nov 2010 16:58:07 
-0000      1.7
+++ t/results/invalid_nestings/recursive_copying.pl     4 Dec 2010 13:19:38 
-0000       1.8
@@ -37,10 +37,6 @@
           'type' => 'empty_line'
         },
         {
-          'cmdname' => 'insertcopying',
-          'parent' => {}
-        },
-        {
           'parent' => {},
           'text' => '
 '
@@ -78,7 +74,6 @@
 $result_trees{'recursive_copying'}{'contents'}[0]{'contents'}[2]{'parent'} = 
$result_trees{'recursive_copying'}{'contents'}[0];
 $result_trees{'recursive_copying'}{'contents'}[0]{'contents'}[3]{'parent'} = 
$result_trees{'recursive_copying'}{'contents'}[0];
 $result_trees{'recursive_copying'}{'contents'}[0]{'contents'}[4]{'parent'} = 
$result_trees{'recursive_copying'}{'contents'}[0];
-$result_trees{'recursive_copying'}{'contents'}[0]{'contents'}[5]{'parent'} = 
$result_trees{'recursive_copying'}{'contents'}[0];
 $result_trees{'recursive_copying'}{'contents'}[0]{'parent'} = 
$result_trees{'recursive_copying'};
 $result_trees{'recursive_copying'}{'contents'}[1]{'parent'} = 
$result_trees{'recursive_copying'};
 $result_trees{'recursive_copying'}{'contents'}[2]{'parent'} = 
$result_trees{'recursive_copying'};
@@ -89,7 +84,7 @@
 
 In copying.
 
address@hidden
+
 @end copying
 
 @insertcopying
@@ -100,7 +95,17 @@
 
 ';
 
-$result_errors{'recursive_copying'} = [];
+$result_errors{'recursive_copying'} = [
+  {
+    'error_line' => ':5: @insertcopying not allowed inside address@hidden' 
block
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@insertcopying not allowed inside address@hidden' block',
+    'type' => 'error'
+  }
+];
 
 
 1;



reply via email to

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