texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Parser.pm t/results/columnfr...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Parser.pm t/results/columnfr...
Date: Tue, 21 Sep 2010 21:55:25 +0000

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

Modified files:
        tp/Texinfo     : Parser.pm 
        tp/t/results   : columnfractions.pl 

Log message:
        Really go back to parent content when closing a command with braces.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions.pl?cvsroot=texinfo&r1=1.2&r2=1.3

Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Texinfo/Parser.pm   21 Sep 2010 21:22:14 -0000      1.4
+++ Texinfo/Parser.pm   21 Sep 2010 21:55:25 -0000      1.5
@@ -466,6 +466,29 @@
 
 # internal sub
 
+sub _print_current($)
+{
+  my $current = shift;
+  my $type = '';
+  my $cmd = '';
+  my $parent_string = '';
+  $type = "($current->{'type'})" if (defined($current->{'type'}));
+  $cmd = "address@hidden>{'cmdname'}" if (defined($current->{'cmdname'}));
+  if ($current->{'parent'}) {
+    my $parent = $current->{'parent'};
+    my $parent_cmd = '';
+    my $parent_type = '';
+    $parent_cmd = "address@hidden>{'cmdname'}" if 
(defined($parent->{'cmdname'}));
+    $parent_type = "($parent->{'type'})" if (defined($parent->{'type'}));
+    $parent_string = " <- $parent_cmd$parent_type\n";
+  }
+  my $args = '';
+  my $contents = '';
+  $args = "args(".scalar(@{$current->{'args'}}).')' if $current->{'args'};
+  $contents = "contents(".scalar(@{$current->{'contents'}}).')' if 
$current->{'contents'};
+  print STDERR "$cmd$type : $args $contents\n$parent_string";
+}
+
 sub _line_warn($$$)
 {
   my $parser = shift;
@@ -851,9 +874,14 @@
         }
         elsif ($separator eq '}') { 
           # FIXME use parents
-          if ($current->{'type'} and ($current->{'type'} eq 'bracketed' or 
$current->{'type'} eq 'brace_command_arg')) {
+          #_print_current ($current);
+          if ($current->{'type'} and ($current->{'type'} eq 'bracketed')) {
              $current = $current->{'parent'};
           }
+          elsif ($current->{'type'} and ($current->{'type'} eq 
'brace_command_arg')) {
+             # first is the command.
+             $current = $current->{'parent'}->{'parent'};
+          }
           else {
             return undef if _line_error ($self, sprintf($self->__("Misplaced 
%c"), ord('}')), $line_nr);
           }

Index: t/results/columnfractions.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/columnfractions.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions.pl        21 Sep 2010 21:22:14 -0000      1.2
+++ t/results/columnfractions.pl        21 Sep 2010 21:55:25 -0000      1.3
@@ -283,7 +283,8 @@
                                                      'args' => [
                                                                  {
                                                                    'cmdname' 
=> 'columnfractions',
-                                                                   'contents' 
=> [
+                                                                   'parent' => 
{}
+                                                                 },
                                                                                
    {
                                                                                
      'args' => [
                                                                                
                  {
@@ -298,38 +299,42 @@
                                                                                
                  }
                                                                                
                ],
                                                                                
      'cmdname' => 'b',
-                                                                               
      'contents' => [
+                                                                   'parent' => 
{},
+                                                                   
'remaining_args' => 0
+                                                                 },
                                                                                
                      {
                                                                                
                        'parent' => {},
                                                                                
                        'text' => ' 
 '
                                                                                
                      }
                                                                                
                    ],
-                                                                               
      'parent' => {},
-                                                                               
      'remaining_args' => 0
-                                                                               
    }
-                                                                               
  ],
-                                                                   'parent' => 
{},
-                                                                   'type' => 
'block_line_arg'
-                                                                 }
-                                                               ],
                                                      'cmdname' => 'multitable',
                                                      'parent' => {}
                                                    }
                                                  ]
                                  };
-$result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'args'}[0];
-$result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'wrong_command'}{'contents'}[0]{'args'}[0];
 $result_trees{'wrong_command'}{'contents'}[0]{'args'}[0]{'parent'} = 
$result_trees{'wrong_command'}{'contents'}[0];
+$result_trees{'wrong_command'}{'contents'}[0]{'args'}[1]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'wrong_command'}{'contents'}[0]{'args'}[1]{'args'}[0];
+$result_trees{'wrong_command'}{'contents'}[0]{'args'}[1]{'args'}[0]{'parent'} 
= $result_trees{'wrong_command'}{'contents'}[0]{'args'}[1];
+$result_trees{'wrong_command'}{'contents'}[0]{'args'}[1]{'parent'} = 
$result_trees{'wrong_command'}{'contents'}[0];
+$result_trees{'wrong_command'}{'contents'}[0]{'args'}[2]{'parent'} = 
$result_trees{'wrong_command'}{'contents'}[0];
 $result_trees{'wrong_command'}{'contents'}[0]{'parent'} = 
$result_trees{'wrong_command'};
 
-$result_texts{'wrong_command'} = '@multitable @address@hidden 
+$result_texts{'wrong_command'} = '@multitable @columnfractions @b{3.4}  
 @end multitable
 ';
 
-$result_errors{'wrong_command'} = [];
+$result_errors{'wrong_command'} = [
+                                    {
+                                      'error_line' => ':1: @columnfractions 
accepts only fractions as argument
+',
+                                      'file_name' => '',
+                                      'line_nr' => 1,
+                                      'macro' => '',
+                                      'text' => '@columnfractions accepts only 
fractions as argument',
+                                      'type' => 'error'
+                                    }
+                                  ];
 
 
 



reply via email to

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