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/coverage...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Parser.pm t/results/coverage...
Date: Tue, 28 Sep 2010 19:05:00 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        10/09/28 19:05:00

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

Log message:
        Handle @set.
        Simplify def* line handling.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/def.pl?cvsroot=texinfo&r1=1.1&r2=1.2

Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- Texinfo/Parser.pm   27 Sep 2010 22:06:15 -0000      1.24
+++ Texinfo/Parser.pm   28 Sep 2010 19:05:00 -0000      1.25
@@ -68,7 +68,9 @@
   'debug' => 0,
   'gettext' => sub {return $_[0];},
   'aliases' => {},
-  'indices' => []
+  'indices' => [],
+  'values' => {},
+  'macros' => {}
 );
 
 my %no_brace_commands;             # commands never taking braces
@@ -85,8 +87,9 @@
   'node' => {'arg' => 'line'}, # special arg
   'bye' => {'skip' => 'line'}, # no arg
   # set, clear
-  'set' => {'arg' => 'lineraw'}, # special arg
-  'clear' => {'arg' => 1, 'skip' => 'line'}, # special arg
+  'set' => {'arg' => 'special'}, # special arg
+  #'clear' => {'arg' => 1, 'skip' => 'line'}, # special arg
+  'clear' => {'arg' => 'special'}, # special arg
   # comments
   'comment' => {'arg' => 'lineraw'},
   'c' => {'arg' => 'lineraw'},
@@ -284,7 +287,6 @@
   $misc_commands{$def_command.'x'} = {'arg' => 'line'};
   $def_commands{$def_command} = 1;
   $def_commands{$def_command.'x'} = 1;
-  $def_commands{'line_'.$def_command} = 1;
 }
 
 $block_commands{'multitable'} = 'multitable';
@@ -825,7 +827,7 @@
 #
 #c 'paragraph'
 #
-#a 'line_def*'
+#a 'def_line'
 #
 #special for @verb, type is the character
 
@@ -1100,7 +1102,7 @@
                 $self->_line_error(sprintf($self->__("Must be in 
address@hidden' environment to use address@hidden'"), $base_command, $command), 
$line_nr);
               }
               push @{$self->{'context'}}, 'def';
-              $current->{'contents'}->[-1]->{'type'} = "line_$base_command";
+              $current->{'contents'}->[-1]->{'type'} = 'def_line';
             }
               
             foreach my $arg (@$args) {
@@ -1143,7 +1145,7 @@
                                                 'contents' => [] };
               $current = $current->{'contents'}->[-1];
               push @{$current->{'contents'}}, { 
-                                                'type' => "line_$command",
+                                                'type' => 'def_line',
                                                 'parent' => $current,
                                                 };
             } else {
@@ -1271,7 +1273,7 @@
               and (($current->{'parent'}->{'cmdname'}
                      and $current->{'parent'}->{'cmdname'} eq 'multitable')
                    or ($current->{'parent'}->{'type'} 
-                       and $def_commands{$current->{'parent'}->{'type'}}))) {
+                       and $current->{'parent'}->{'type'} eq 'def_line'))) {
             push @{$current->{'contents'}},
                  { 'type' => 'bracketed', 'contents' => [],
                    'parent' => $current };
@@ -1446,7 +1448,7 @@
         # def line
         } elsif ($current->{'parent'}
              and $current->{'parent'}->{'type'}
-                    and $def_commands{$current->{'parent'}->{'type'}}) {
+                    and $current->{'parent'}->{'type'} eq 'def_line') {
             my $def_context = pop @{$self->{'context'}};
             die "BUG: def_context $def_context "._print_current($current) 
                if ($def_context ne 'def');
@@ -1594,7 +1596,7 @@
     $result .= $root->{'text'};
   } else {
     if ($root->{'cmdname'} 
-       or ($root->{'type'} and ($def_commands{$root->{'type'}}
+       or ($root->{'type'} and ($root->{'type'} eq 'def_line'
                                 or $root->{'type'} eq 'menu_entry'
                                 or $root->{'type'} eq 'menu_comment'))) {
       #print STDERR "cmd: $root->{'cmdname'}\n";
@@ -1736,12 +1738,20 @@
   } elsif ($command eq 'set') {
     if ($line =~ /^(\s+)([\w\-]+)(\s+)(.*)$/) {
       $args = [$2, $4];
+      $self->{'values'}->{$2} = $4;
     } else {
       _line_error ($self, sprintf($self->
                     __("%c%s requires a name"), ord('@'), $command), $line_nr);
     }
     $line = '';
-
+  } elsif ($command eq 'clear') {
+    if ($line =~ /^(\s+)([\w\-]+)/) {
+      $args = [$2];
+      delete $self->{'values'}->{$2};
+    } else {
+      _line_error ($self, sprintf($self->
+                    __("%c%s requires a name"), ord('@'), $command), $line_nr);
+    }
   } elsif ($command eq 'defindex' || $command eq 'defcodeindex') {
     if ($line =~ s/^\s+(\w+)\s*//) {
       my $name = $1;

Index: t/results/coverage/def.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/coverage/def.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/coverage/def.pl   26 Sep 2010 18:10:34 -0000      1.1
+++ t/results/coverage/def.pl   28 Sep 2010 19:05:00 -0000      1.2
@@ -36,7 +36,7 @@
             }
           ],
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'contents' => [
@@ -84,7 +84,7 @@
             }
           ],
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'contents' => [
@@ -145,7 +145,7 @@
             }
           ],
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -182,7 +182,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -223,7 +223,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -264,7 +264,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -305,7 +305,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -344,7 +344,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -404,7 +404,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -427,7 +427,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -464,7 +464,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -492,7 +492,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -520,7 +520,7 @@
           ],
           'cmdname' => 'deffnx',
           'parent' => {},
-          'type' => 'line_deffn'
+          'type' => 'def_line'
         },
         {
           'args' => [
@@ -567,7 +567,7 @@
               ],
               'cmdname' => 'deffnx',
               'parent' => {},
-              'type' => 'line_deffn'
+              'type' => 'def_line'
             },
             {
               'args' => [
@@ -612,7 +612,7 @@
               ],
               'cmdname' => 'deffnx',
               'parent' => {},
-              'type' => 'line_deffn'
+              'type' => 'def_line'
             }
           ],
           'parent' => {},



reply via email to

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