texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Parser.pm t/results/par...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Parser.pm t/results/par...
Date: Thu, 30 Sep 2010 22:03:53 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        10/09/30 22:03:52

Modified files:
        tp             : TODO 
        tp/Texinfo     : Parser.pm 
        tp/t/results/paragraph: close_paragraph_command.pl 
Added files:
        tp/t           : 08misc_commands.t 

Log message:
        Parse misc command arguments.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/08misc_commands.t?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/paragraph/close_paragraph_command.pl?cvsroot=texinfo&r1=1.1&r2=1.2

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- TODO        22 Sep 2010 22:02:47 -0000      1.2
+++ TODO        30 Sep 2010 22:03:52 -0000      1.3
@@ -10,3 +10,8 @@
 involved would be a matter of checking if the column number was < or >
 the place where the error occurred.
 
+
+test invalid, especially commands not closed/bad nesting
+test root_commands, like nodes and sections
+values and user defined macro expansion in line @-commands, line
address@hidden argument checking.

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- Texinfo/Parser.pm   30 Sep 2010 06:49:47 -0000      1.31
+++ Texinfo/Parser.pm   30 Sep 2010 22:03:52 -0000      1.32
@@ -90,13 +90,13 @@
   'set' => {'arg' => 'special'}, # special arg
   #'clear' => {'arg' => 1, 'skip' => 'line'}, # special arg
   'clear' => {'arg' => 'special'}, # special arg
-  'unmacro' => {'arg' => 1}, 
+  'unmacro' => {'arg' => 'special'}, 
   # comments
   'comment' => {'arg' => 'lineraw'},
   'c' => {'arg' => 'lineraw'},
   # special
-  'definfoenclose' => {'arg' => 'special'},
-  'alias' => {'args' => 'special'}, 
+  'definfoenclose' => {'arg' => 5, 'skip' => 'line'},
+  'alias' => {'arg' => '3', 'skip' => 'line'}, 
   # file names
   'setfilename' => {'arg' => 'line'},
   'verbatiminclude'=> {'arg' => 'line'},
@@ -107,12 +107,13 @@
   'shortcontents' => {}, # no arg
   'summarycontents'=> {}, # no arg
   'insertcopying'=> {}, # no arg
-  'clickstyle' => {'arg' => 1}, # arg should be an @-command
+  'clickstyle' => {'arg' => 'special'}, # arg should be an @-command
   # more relevant in preamble
-  'documentencoding' => {'arg' => 1, 'skip' => 'line'},
-  'setcontentsaftertitlepage' => {}, # no arg
-  'setshortcontentsaftertitlepage' => {}, # no arg
-  'novalidate' => {}, # no arg
+  #'documentencoding' => {'arg' => 1, 'skip' => 'line'},
+  'documentencoding' => {'arg' => 'line'},
+  'setcontentsaftertitlepage' => {'skip' => 'line'}, # no arg
+  'setshortcontentsaftertitlepage' => {'skip' => 'line'}, # no arg
+  'novalidate' => {'skip' => 'line'}, # no arg
   'dircategory'=> {'arg' => 'line'}, # line. Position with regard 
                    # with direntry is significant
   'pagesizes' => {'arg' => 'line'}, # can have 2 args 
@@ -123,7 +124,7 @@
   'firstparagraphindent' => {'skip' => 'line', 'arg' => 1}, # none insert
   'frenchspacing' => {'arg' => 1, 'skip' => 'line'}, # on off
                                  # not so sure about 'skip' => 'line'
-  'fonttextsize' => {'arg' => 1}, # 10 11
+  'fonttextsize' => {'arg' => 1, 'skip' => 'line'}, # 10 11
   'allowcodebreaks' => {'arg' => 1, 'skip' => 'line'}, # false or true
   'exampleindent' => {'skip' => 'line', 'arg' => 1}, # asis or a number
   'footnotestyle'=> {'skip' => 'line', 'arg' => 1}, # end and separate
@@ -138,34 +139,37 @@
   'setchapternewpage' => {'skip' => 'line', 'arg' => 1}, # off on odd
   # FIXME for the following the @this* commands are not defined. Also
   # @value and maybe macro invocations may also be delayed.
-  'everyheading' => {'arg' => 'line'}, # @*heading @*footing use @|
-  'everyfooting' => {'arg' => 'line'}, # + @thispage @thissectionname 
@thissectionnum
-  'evenheading' => {'arg' => 'line'},  # @thissection @thischaptername 
@thischapternum 
-  'evenfooting' => {'arg' => 'line'},  # @thischapter @thistitle @thisfile
-  'oddheading' => {'arg' => 'line'},
-  'oddfooting' => {'arg' => 'line'},
+  'everyheading' => {'arg' => 'lineraw'}, # @*heading @*footing use @|
+  'everyfooting' => {'arg' => 'lineraw'}, # + @thispage @thissectionname 
@thissectionnum
+  'evenheading' => {'arg' => 'lineraw'},  # @thissection @thischaptername 
@thischapternum 
+  'evenfooting' => {'arg' => 'lineraw'},  # @thischapter @thistitle @thisfile
+  'oddheading' => {'arg' => 'lineraw'},
+  'oddfooting' => {'arg' => 'lineraw'},
   'smallbook' => {'skip' => 'line'}, # no arg
   'syncodeindex' => {'skip' => 'line', 'arg' => 2},
                     # args are index identifiers
   'synindex' => {'skip' => 'line', 'arg' => 2},
-  'defindex' => {'skip' => 'line', 'arg' => 'special'}, # one identifier arg
-  'defcodeindex' => {'skip' => 'line', 'arg' => 'special'}, # one identifier 
arg
-  'documentlanguage' => {'skip' => 'line', 'arg' => 1},
+  'defindex' => {'skip' => 'line', 'arg' => 1}, # one identifier arg
+  'defcodeindex' => {'skip' => 'line', 'arg' => 1}, # one identifier arg
+  #'documentlanguage' => {'skip' => 'line', 'arg' => 1},
+  'documentlanguage' => {'arg' => 'line'},
                                                  # language code arg
-  'kbdinputstyle' => {'skip' => 'whitespace', 'arg' => 1}, # code 
+  'kbdinputstyle' => {'skip' => 'line', 'arg' => 1}, # code 
                                                   #example distinct
   'everyheadingmarks' => {'skip' => 'line', 'arg' => 1}, # top bottom
-  'everyfootingmarks' => {'skip' => 'whitespace', 'arg' => 1},
-  'evenheadingmarks' => {'skip' => 'whitespace', 'arg' => 1},
-  'oddheadingmarks' => {'skip' => 'whitespace', 'arg' => 1},
-  'evenfootingmarks' => {'skip' => 'whitespace', 'arg' => 1},
-  'oddfootingmarks' => {'skip' => 'whitespace', 'arg' => 1},
+  'everyfootingmarks' => {'skip' => 'line', 'arg' => 1},
+  'evenheadingmarks' => {'skip' => 'line', 'arg' => 1},
+  'oddheadingmarks' => {'skip' => 'line', 'arg' => 1},
+  'evenfootingmarks' => {'skip' => 'line', 'arg' => 1},
+  'oddfootingmarks' => {'skip' => 'line', 'arg' => 1},
   # not valid for info (should be in @iftex)
-  'cropmarks' => {}, # no arg
+  'cropmarks' => {'skip' => 'line'}, # no arg
 
   # formatting
   'center' => {'arg' => 'line'},
-  'printindex' => {'arg' => 1, 'skip' => 'line'},
+  # FIXME, line or arg? Verify the index exists?
+  'printindex' => {'arg' => 'line'},
+  #'printindex' => {'arg' => 1, 'skip' => 'line'},
   'listoffloats' => {'arg' => 'line'},
   # especially in titlepage
   'shorttitle' => {'arg' => 'line'},
@@ -174,9 +178,10 @@
   'author' => {'arg' => 'line'},
   'subtitle' => {'arg' => 'line'},
   'title' => {'arg' => 'line'},
-  'sp' => {'skip' => 'line', 'arg' => 1}, # no arg 
+  #'sp' => {'skip' => 'line', 'arg' => 1}, # no arg 
+  'sp' => {'arg' => 'line'}, # no arg 
                               # at the end of line or a numerical arg
-  'page' => {}, # no arg (pagebreak)
+  'page' => {'skip' => 'line'}, # no arg (pagebreak)
   'need' => {'skip' => 'line', 'arg' => 1}, # one numerical/real arg
   # formatting
   'noindent' => {'skip' => 'whitespace'}, # no arg
@@ -1189,7 +1194,7 @@
              if ($self->{'debug'}); 
           my $expanded_lines = _text_to_lines($expanded);
           $expanded_lines = [''] if !(@$expanded_lines);
-          print STDERR "1MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
+          print STDERR "MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
                                        ."\nEND LINES\n" if ($self->{'debug'});
           chomp ($expanded_lines->[-1]);
           my $new_lines_nr = _complete_line_nr($expanded_lines, 
@@ -1802,7 +1807,20 @@
         } elsif ($current->{'type'} 
            and $current->{'type'} eq 'misc_line_arg') {
           # first parent is the @command, second is the parent
-          $current = $current->{'parent'}->{'parent'};
+          $current = $current->{'parent'};
+          print STDERR "MISC END address@hidden>{'cmdname'}\n" if 
($self->{'debug'});
+          if ($self->{'misc_commands'}->{$current->{'cmdname'}}->{'arg'}
+              and $self->{'misc_commands'}->{$current->{'cmdname'}}->{'arg'} 
=~ /^\d$/) {
+            my $args = _parse_line_command_args ($self, $current, $line_nr);
+            $current->{'special'}->{'line_args'} = $current->{'args'};
+            $current->{'args'} = [];
+            foreach my $arg (@$args) {
+              push @{$current->{'args'}},
+                { 'type' => 'misc_arg', 'text' => $arg, 
+                  'parent' => $current };
+            }
+          }
+          $current = $current->{'parent'};
         }
         last;
       }
@@ -1962,25 +1980,8 @@
     if (defined($self->{'misc_commands'}->{$command}->{'arg'}));
 #print STDERR "HHHHHHHHH $line $command arg_spec $arg_spec skip_spec 
$skip_spec\n";
 
-  if ($command eq 'alias') {
-    if ($line =~ s/(\s+)([a-zA-Z][\w-]*)(\s*=\s*)([a-zA-Z][\w-]*)(\s*)//) {
-      $self->{'aliases'}->{$2} = $4;
-      $args = [$2, $4];
-    } else {
-      _line_error ($self, sprintf($self->
-                              __("Bad argument to address@hidden"), $command), 
$line_nr);
-    }
 
-  } elsif ($command eq 'definfoenclose') {
-    if ($line =~ s/^\s+([a-z][\w\-]*)\s*,\s*([^\s]+)\s*,\s*([^\s]+)//) {
-      $args = [$1, $2, $3 ];
-      $self->{'info_enclose'}->{$1} = [ $2, $3 ];
-    } else {
-      _line_error ($self, sprintf($self->
-                              __("Bad argument to address@hidden"), $command), 
$line_nr);
-    } # FIXME warn about garbage remaining on the line?
-
-  } elsif ($command eq 'set') {
+  if ($command eq 'set') {
     if ($line =~ /^(\s+)([\w\-]+)(\s+)(.*)$/) {
       $args = [$2, $4];
       $self->{'values'}->{$2} = $4;
@@ -2006,24 +2007,16 @@
       _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;
-      if ($forbidden_index_name{$name}) {
-        _line_error($self, sprintf($self->
-                                __("Reserved index name %s"),$name), $line_nr);
-      } else {
-        $self->{'misc_commands'}->{$name.'index'} = { 'arg' => 'line' };
-      }
+  } elsif ($command eq 'clickstyle') {
+    if ($line =~ s/^\s+@(address@hidden)({})?\s*//) {
+      $args = [$1];
     } else {
-      _line_error ($self, sprintf($self->
-                   __("Bad argument to address@hidden: %s"), $command, $line), 
$line_nr);
+      _line_error ($self, sprintf($self->__("address@hidden should only accept 
a address@hidden as argument, not `%s'"), $command, $line), $line_nr);
     }
-
-  } elsif ($arg_spec eq 'line' or $arg_spec eq 'lineraw') {
+  } elsif ($arg_spec eq 'line' or $arg_spec eq 'lineraw' or $arg_spec) {
     $line =~ s/^[ \t]*// unless ($command eq 'c' or $command eq 'comment');
     $args = [ $line ];
-    if ($arg_spec eq 'line') {
+    if ($arg_spec ne 'lineraw') {
       $line_arg = $line;
     }
     else {
@@ -2031,18 +2024,18 @@
     }
     $line = '';
 
-  } elsif ($arg_spec) {
-    my $arg_nr = $arg_spec;
-    while ($arg_nr) {
-      if ($line =~ s/^(\s+)(\S*)//o) {
-        my $argument = $2;
-        push @$args, $argument if ($argument ne '');
-      } else {
-        last;
-      }
-      $arg_nr--;
-    }
-  }
+  } #elsif ($arg_spec) {
+    #my $arg_nr = $arg_spec;
+    #while ($arg_nr) {
+    #  if ($line =~ s/^(\s+)(\S*)//o) {
+    #    my $argument = $2;
+    #    push @$args, $argument if ($argument ne '');
+    #  } else {
+    #    last;
+    #  }
+    #  $arg_nr--;
+    #}
+  #}
 
   if ($skip_spec eq 'line') {
     $line = '';
@@ -2058,6 +2051,180 @@
   return ($line, $args, $line_arg, $special);
 }
 
+sub _parse_line_command_args($$$)
+{
+  my $self = shift;
+  my $line_command = shift;
+  my $line_nr = shift;
+
+  my $args;
+
+  my $command = $line_command->{'cmdname'};
+  my $arg = $line_command->{'args'}->[0];
+
+  print STDERR "MISC ARGS address@hidden" if ($self->{'debug'});
+
+  if (! @{$arg->{'contents'}} 
+       or ($arg->{'contents'}->[0]->{'cmdname'} 
+            and ($arg->{'contents'}->[0]->{'cmdname'} eq 'c' 
+                 or $arg->{'contents'}->[0]->{'cmdname'} eq 'comment'))) {
+    _line_error ($self, sprintf($self->__("address@hidden missing argument"), 
+       $command), $line_nr);
+    return undef;
+  }
+
+  if (@{$arg->{'contents'}} > 2 or (@{$arg->{'contents'}} == 2
+         and (!$arg->{'contents'}->[1]->{'cmdname'} 
+              or $arg->{'contents'}->[1]->{'cmdname'} ne 'c' 
+              or $arg->{'contents'}->[1]->{'cmdname'} ne 'comment'))
+         or (!defined($arg->{'contents'}->[0]->{'text'}))) {
+    _line_error ($self, sprintf($self->__("Bad argument to address@hidden"),
+       $command), $line_nr);
+  }
+  return undef if (!defined($arg->{'contents'}->[0]->{'text'}));
+  
+  my $line = $arg->{'contents'}->[0]->{'text'};  
+
+  if ($command eq 'alias') {
+    if ($line =~ s/^([\w-]+)(\s*=\s*)([\w-]+)(\s*)//) {
+      $self->{'aliases'}->{$1} = $3;
+      $args = [$2, $4];
+    } else {
+      _line_error ($self, sprintf($self->
+                              __("Bad argument to address@hidden"), $command), 
$line_nr);
+    }
+
+  } elsif ($command eq 'definfoenclose') {
+    if ($line =~ s/^([\w\-]+)\s*,\s*([^\s]+)\s*,\s*([^\s]+)//) {
+      $args = [$1, $2, $3 ];
+      $self->{'info_enclose'}->{$1} = [ $2, $3 ];
+    } else {
+      _line_error ($self, sprintf($self->
+                              __("Bad argument to address@hidden"), $command), 
$line_nr);
+    }
+  } elsif ($command eq 'defindex' || $command eq 'defcodeindex') {
+    if ($line =~ /^(\w+)\s*/) {
+      my $name = $1;
+      if ($forbidden_index_name{$name}) {
+        _line_error($self, sprintf($self->
+                                __("Reserved index name %s"),$name), $line_nr);
+      } else {
+        $args = [$name];
+        $self->{'misc_commands'}->{$name.'index'} = { 'arg' => 'line' };
+      }
+    } else {
+      _line_error ($self, sprintf($self->
+                   __("Bad argument to address@hidden: %s"), $command, $line), 
$line_nr);
+    }
+  } elsif ($command eq 'synindex' || $command eq 'syncodeindex') {
+    if ($line =~ /^(\w+)\s+(\w+)/) {
+      my $index_from = $1;
+      my $index_to = $2;
+      _line_error ($self, sprintf($self->__("Unknown from index `%s' in 
address@hidden"), $index_from, $command), $line_nr)
+        unless $self->{'misc_commands'}->{$index_from.'index'};
+      _line_error ($self, sprintf($self->__("Unknown to index name `%s' in 
address@hidden"), $index_to, $command), $line_nr)
+        unless $self->{'misc_commands'}->{$index_to.'index'};
+      if ($self->{'misc_commands'}->{$index_from.'index'} 
+           and $self->{'misc_commands'}->{$index_to.'index'}) {
+        $args = [$index_from, $index_to];
+      }
+    } else {
+      _line_error ($self, sprintf($self->__("Bad argument to address@hidden: 
%s"), $command, $line), $line_nr);
+    }
+  } elsif (grep {$_ eq $command} ('everyheadingmarks', 'everyfootingmarks',
+                                  'evenheadingmarks', 'oddheadingmarks',
+                                  'evenfootingmarks', 'oddfootingmarks')) {
+    if (($line =~ /^(top)[^\w\-]/) or ($line =~ /^(bottom)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be `top' 
or `bottom', not `%s'"), $command, $line), $line_nr);
+    }
+  } elsif ($command eq 'fonttextsize') {
+    if (($line =~ /^(10)[^\w\-]/) or ($line =~ /^(11)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("Only address@hidden 10 or 11 is 
supported, not `%s'"),$command, $line), $line_nr);
+    }
+  } elsif ($command eq 'footnotestyle') {
+    if ($line =~ /^([a-z]+)[^\w\-]/ and ($1 eq 'separate' or $1 eq 'end')) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be 
`separate' or `end', not `%s'"), $command, $line), $line_nr);
+    }
+  } elsif ($command eq 'setchapternewpage') {
+    if (($line =~ /^(on)[^\w\-]/) or ($line =~ /^(off)[^\w\-]/)
+       or ($line =~ /^(odd)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be `on', 
`off' or `odd', not `%s'"), $command, $line), $line_nr);
+    }
+  } elsif ($command eq 'need') { # only a warning
+    if (($line =~ /^([0-9]+(\.[0-9]*)?)[^\w\-]/) or
+             ($line =~ /^(\.[0-9]+)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("Bad argument to address@hidden: 
%s"), $command, $line), $line_nr);
+    }
+  } elsif ($command eq 'paragraphindent') {
+    if ($line =~ /^([\w\-]+)[^\w\-]/) {
+      my $value = $1;
+      if ($value =~ /^([0-9]+)$/ or $value eq 'none' or $value eq 'asis') {
+        $args = [$1];
+      } else {
+        _line_error ($self, sprintf($self->__("address@hidden arg must be 
numeric/`none'/`asis', not `%s'"), $value), $line_nr);
+      } 
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be 
numeric/`none'/`asis', not `%s'"), $line), $line_nr);
+    }
+  } elsif ($command eq 'firstparagraphindent') {
+    if (($line =~ /^(none)[^\w\-]/) or ($line =~ /^(insert)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be `none' 
or `insert', not `%s'"), $line), $line_nr);
+    }
+  } elsif ($command eq 'exampleindent') {
+    if ($line =~ /^([0-9]+)/) {
+      $args = [$1];
+    } elsif ($line =~ /^(asis)[^\w\-]/) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be 
numeric/`asis', not `%s'"), $line), $line_nr);
+    }
+  } elsif ($command eq 'frenchspacing') {
+    if (($line =~ /^(on)[^\w\-]/) or ($line =~ /^(off)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("Expected address@hidden on or 
off, not `%s'"), $command, $line), $line_nr);
+    }
+  } elsif ($command eq 'kbdinputstyle') {
+    if ($line =~ /^([a-z]+)/ and ($1 eq 'code' or $1 eq 'example' or $1 eq 
'distinct')) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be 
`code'/`example'/`distinct', not `%s'"), $line), $line_nr);
+    }
+  } elsif ($command eq 'allowcodebreaks') {
+    if (($line =~ /^(true)[^\w\-]/) or ($line =~ /^(false)[^\w\-]/)) {
+      $args = [$1];
+    } else {
+      _line_error ($self, sprintf($self->__("address@hidden arg must be `true' 
or `false', not `%s'"), $line), $line_nr);
+    }
+  } elsif ($command eq 'headings') {
+    my $valid_arg = 0;
+    foreach my $possible_arg ('off','on','single','double',
+                               'singleafter','doubleafter') {
+      if ($line =~ /^($possible_arg)[^\w\-]/) {
+        $args = [$1];
+        $valid_arg = 1;
+        last;
+      }
+    }
+    unless ($valid_arg) {
+      _line_error ($self, sprintf($self->__("Bad argument to address@hidden: 
%s"), $command, $line), $line_nr);
+    }
+  }
+  return $args;
+}
+
 1;
 __END__
 # Below is stub documentation.

Index: t/results/paragraph/close_paragraph_command.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/paragraph/close_paragraph_command.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/paragraph/close_paragraph_command.pl      26 Sep 2010 07:43:25 
-0000      1.1
+++ t/results/paragraph/close_paragraph_command.pl      30 Sep 2010 22:03:52 
-0000      1.2
@@ -60,9 +60,15 @@
     {
       'args' => [
         {
+          'contents' => [
+            {
+              'parent' => {},
+              'text' => '4
+'
+            }
+          ],
           'parent' => {},
-          'text' => '4',
-          'type' => 'misc_arg'
+          'type' => 'misc_line_arg'
         }
       ],
       'cmdname' => 'sp',
@@ -90,6 +96,7 @@
 $result_trees{'close_paragraph_command'}{'contents'}[3]{'parent'} = 
$result_trees{'close_paragraph_command'};
 
$result_trees{'close_paragraph_command'}{'contents'}[4]{'contents'}[0]{'parent'}
 = $result_trees{'close_paragraph_command'}{'contents'}[4];
 $result_trees{'close_paragraph_command'}{'contents'}[4]{'parent'} = 
$result_trees{'close_paragraph_command'};
+$result_trees{'close_paragraph_command'}{'contents'}[5]{'args'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'close_paragraph_command'}{'contents'}[5]{'args'}[0];
 $result_trees{'close_paragraph_command'}{'contents'}[5]{'args'}[0]{'parent'} = 
$result_trees{'close_paragraph_command'}{'contents'}[5];
 $result_trees{'close_paragraph_command'}{'contents'}[5]{'parent'} = 
$result_trees{'close_paragraph_command'};
 
$result_trees{'close_paragraph_command'}{'contents'}[6]{'contents'}[0]{'parent'}
 = $result_trees{'close_paragraph_command'}{'contents'}[6];

Index: t/08misc_commands.t
===================================================================
RCS file: t/08misc_commands.t
diff -N t/08misc_commands.t
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/08misc_commands.t 30 Sep 2010 22:03:52 -0000      1.1
@@ -0,0 +1,142 @@
+use strict;
+
+require 't/test_utils.pl';
+
+my @test_cases = (
+['simple', '@defindex idx'],
+['many_lines', 'pagesizes @pagesizes 200mm,150mm following @@pagesizes arg
+afourpaper @afourpaper on line following afourpaper
+smallbook @smallbook on line following smallbook
+headings @headings on line following headings
+oddfooting @oddfooting on line following oddfooting
+everyheading @everyheading on line following everyheading
+everyfooting @everyfooting on line following everyfooting
+evenheading @evenheading on line following evenheading
+evenfooting @evenfooting on line following evenfooting
+oddheading @oddheading on line following
+need @need 0.1 on line following
+need @need 0.1
+setchapternewpage @setchapternewpage on line following setchapternewpage
+raisesections @raisesections on line following raisesections
+lowersections @lowersections on line following lowersections
+kbdinputstyle code @kbdinputstyle code something
+afourpaper @afourpaper on line following afourpaper
+afourlatex @afourlatex on line following afourlatex
+afourwide @afourwide on line following afourwide
+paragraphindent asis @paragraphindent asis
+paragraphindent 0 @paragraphindent 0
+paragraphindent none @paragraphindent none
+paragraphindent 4 @paragraphindent 4
+firstparagraphindent none @firstparagraphindent none
+exampleindent 6 @exampleindent 6 on line following exampleindent
+exampleindent 6 @exampleindent 6
+footnotestyle @footnotestyle end 
+footnotestyle @footnotestyle separate 
+documentencoding @documentencoding US-ascii encoding name
address@hidden ISO-8859-1
+frenchspacing @frenchspacing on
+frenchspacing @frenchspacing off
+fonttextsize @fonttextsize 10
+everyheadingmarks @everyheadingmarks bottom on line following everyheadingmarks
address@hidden false
address@hidden true
+
+Text line followed by finalout on the same line and another below @finalout
address@hidden
+Text line after the finalout followed by a fianlout @finalout
+Text line after the text line followed by the finalout.
+
+Test text after finalout
address@hidden a word after finalout
+Line after finalout
+'],
+['also_not_line',
+'
+
+page @page 
+noindent @noindent refill @refill something
+
address@hidden     noindent at beginning of line
address@hidden  
+noindent on the preceding line
+  @noindent    noindent after space at beginning of line
address@hidden         page at beginning of line
address@hidden
+After page on its own line.
+
+page @page   
+noindent @noindent    refill @refill 
+novalidate @novalidate something
+
address@hidden special
+
+Only valid between iftex:
+vskip @vskip 
+cropmarks @cropmarks
+
+exdent @exdent line after exdent
+'],
+['sp',
+'
+Text line followed on the same line and another below @sp 1
address@hidden 2
+Text line after the sp followed by a sp @sp 1
+Text line after the text line followed by the sp.
address@hidden
address@hidden 2 a number after sp
+'],
+['clickstyle',
+'@clickstyle @result
+
+A @click{} (result).
+'],
+['invalid_clickstyle',
+'
address@hidden @result on the same line
+
+A @click{} (result on the same line).
+
address@hidden @nocmd
+
+A @click{} (nocmd).
+
address@hidden something
+
+A @click{} (something).
+'],
+['contents','
+first @@contents @contents line following first content
+second @@contents @contents line following second content
+Third content on the following line on his own
address@hidden
+Line following contents
+shortcontents @shortcontents eol
+shortcontents @shortcontents eol
+summarycontents @summarycontents line following summarycontents
+'],
+['definfoenclose',
+'
+definfoenclose phoo,//,\\  @definfoenclose phoo,//,\\
+
address@hidden
+
+definfoenclose phi,:,:  @definfoenclose phi,:,:
+
address@hidden
+
address@hidden strong}
+
address@hidden strong,(strong:,:)
+
address@hidden is it really strong? }
+'],
+['bad',
+'kbdinputstyle @kbdinputstyle wrong arg on line following kbdinputstyle
+']
+);
+
+our ($arg_test_case, $arg_generate, $arg_debug);
+
+run_all ('misc_commands', address@hidden, $arg_test_case,
+   $arg_generate, $arg_debug);
+



reply via email to

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