[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Parser.pm t/results/inc...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Parser.pm t/results/inc... |
Date: |
Sat, 23 Oct 2010 10:22:22 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/10/23 10:22:22
Modified files:
tp : TODO
tp/Texinfo : Parser.pm
tp/t/results/include: double_include.pl
Log message:
Warn if block command in misck command or block command line, and also
in some commands. Also check that a command is right to be in an
accent and other similar checks.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/include/double_include.pl?cvsroot=texinfo&r1=1.4&r2=1.5
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- TODO 20 Oct 2010 21:43:32 -0000 1.27
+++ TODO 23 Oct 2010 10:22:21 -0000 1.28
@@ -16,10 +16,12 @@
@end example
test invalid, especially commands not closed/bad nesting
-test root_commands, like nodes and sections
-Error message if block or line misc at-command on a
-block command or misc @-command line
+in hyphenation: only text and accent commands, and should
+only appear in toplevel
+
+dotless:
+"%c%s expects `i' or `j' as argument, not `%s'"
Texinfo::Convert::Text
@c in menu lines (and maybe at other places) should be replaced by
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- Texinfo/Parser.pm 21 Oct 2010 22:16:39 -0000 1.90
+++ Texinfo/Parser.pm 23 Oct 2010 10:22:22 -0000 1.91
@@ -205,18 +205,30 @@
# accent commands. They may be called with and without braces.
my %accent_commands;
-foreach my $no_arg_command
('TeX','LaTeX','bullet','copyright','registeredsymbol','dots','enddots','equiv','error','expansion','arrow','minus','point','print','result','today','aa','AA','ae','oe','AE','OE','o','O','ss','l','L','DH','dh','TH','th','exclamdown','questiondown','pounds','ordf','ordm','comma','euro','geq','leq','tie','textdegree','quotedblleft','quotedblright','quoteleft','quoteright','quotedblbase','quotesinglbase','guillemetleft','guillemetright','guillemotleft','guillemotright','guilsinglleft','guilsinglright','click')
{
+foreach my $no_arg_command ('TeX','LaTeX','bullet','copyright',
+ 'registeredsymbol','dots','enddots','equiv','error','expansion','arrow',
+ 'minus','point','print','result','today',
+ 'aa','AA','ae','oe','AE','OE','o','O','ss','l','L','DH','dh','TH','th',
+ 'exclamdown','questiondown','pounds','ordf','ordm','comma','euro',
+ 'geq','leq','tie','textdegree','click',
+ 'quotedblleft','quotedblright','quoteleft','quoteright','quotedblbase',
+ 'quotesinglbase','guillemetleft','guillemetright','guillemotleft',
+ 'guillemotright','guilsinglleft','guilsinglright') {
$brace_commands{$no_arg_command} = 0;
}
foreach my $accent_command ('"','~','^','`',"'",',','=',
'ringaccent','H','dotaccent','u','ubaraccent',
- 'udotaccent','v','ogonek','tieaccent') {
+ 'udotaccent','v','ogonek','tieaccent', 'dotless') {
$accent_commands{$accent_command} = 1;
$brace_commands{$accent_command} = 1;
}
-foreach my $one_arg_command
('asis','b','cite','clicksequence','code','command','ctrl','dfn','dmn','emph','env','file','headitemfont','i','slanted','sansserif','kbd','key',,'option','r','samp','sc','strong','t','indicateurl','var','verb','titlefont','w','hyphenation','anchor','dotless')
{
+foreach my $one_arg_command ('asis','b','cite','clicksequence','code',
+ 'command','ctrl','dfn','dmn','emph','env','file','headitemfont',
+ 'i','slanted','sansserif','kbd','key','option','r','samp','sc','strong',
+ 't','var', 'w', 'verb', 'indicateurl',
+ 'titlefont','hyphenation','anchor') {
$brace_commands{$one_arg_command} = 1;
}
@@ -235,7 +247,7 @@
$brace_commands{$three_arg_command} = 3;
}
-foreach my $five_arg_command('xref','ref','pxref','inforef','image') {
+foreach my $five_arg_command('xref','ref','pxref','image') {
$brace_commands{$five_arg_command} = 5;
}
@@ -249,6 +261,7 @@
$menu_commands{$menu_command} = 1;
};
+
# commands delimiting blocks, with an @end.
# Value is either the number of arguments on the line separated by
# commas or the type of command, 'raw', 'def' or 'multitable'.
@@ -500,6 +513,68 @@
$close_paragraph_commands{$close_paragraph_command} = 1;
}
+# commands that may appear in accents
+my %in_accent_commands = (%no_brace_commands, %accent_commands);
+foreach my $brace_command(keys(%brace_commands)) {
+ $in_accent_commands{$brace_command} = 1 if
(!$brace_commands{$brace_command});
+}
+
+# commands that may appear in texts arguments
+my %in_full_text_commands = %no_brace_commands;
+foreach my $command (keys(%brace_commands)) {
+ $in_full_text_commands{$command} = 1;
+}
+foreach my $misc_command_in_full_text('c', 'comment', 'refill', 'noindent',
+ 'indent', 'columnfractions') {
+ $in_full_text_commands{$misc_command_in_full_text} = 1;
+}
+delete $in_full_text_commands{'caption'};
+delete $in_full_text_commands{'shortcaption'};
+foreach my $block_command (keys(%block_commands)) {
+ $in_full_text_commands{$block_command} = 1
+ if ($block_commands{$block_command} eq 'conditional');
+}
+
+# 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',
+ 'xref','ref','pxref', 'inforef') {
+ delete $in_simple_text_commands{$not_in_simple_text_command};
+}
+
+# commands that only accept simple text as argument in any context.
+# index entry commands are dynamically added.
+my %simple_text_commands;
+foreach my $misc_command(keys(%misc_commands)) {
+ if ($misc_commands{$misc_command} =~ /^\d+$/
+ or ($misc_commands{$misc_command} eq 'line' and
!$root_commands{$misc_command})
+ or $misc_commands{$misc_command} eq 'text') {
+ $simple_text_commands{$misc_command} = 1;
+ }
+}
+delete $simple_text_commands{'center'};
+delete $simple_text_commands{'exdent'};
+foreach my $command ('titlefont', 'anchor', 'xref','ref','pxref',
+ 'inforef', 'shortcaption', 'math', 'indicateurl',
+ 'email', 'uref', 'url', 'image', 'abbr', 'acronym',
+ 'dmn', 'ctrl') {
+ $simple_text_commands{$command} = 1;
+}
+
+# commands that accept full text, but no block or top-level commands
+my %full_text_commands;
+foreach my $brace_command (keys (%brace_commands)) {
+ if ($brace_commands{$brace_command} == 1
+ and (!$simple_text_commands{$brace_command}
+ and !$context_brace_commands{$brace_command})) {
+ $full_text_commands{$brace_command} = 1;
+ }
+}
+$full_text_commands{'center'} = 1;
+$full_text_commands{'exdent'} = 1;
+
+
# deep copy of a structure
sub _deep_copy ($)
@@ -557,10 +632,12 @@
}
}
$parser->{'misc_commands'} = _deep_copy (\%misc_commands);
+ $parser->{'simple_text_commands'} = _deep_copy (\%simple_text_commands);
$parser->{'no_paragraph_commands'} = { %default_no_paragraph_commands };
foreach my $name (@{$parser->{'indices'}}, @default_index_names) {
$parser->{'misc_commands'}->{$name.'index'} = 'line';
$parser->{'no_paragraph_commands'}->{$name.'index'} = 1;
+ $parser->{'simple_text_commands'}->{$name.'index'} = 1;
}
$parser->{'errors_warnings'} = [];
$parser->{'errors_nrs'} = 0;
@@ -2085,6 +2162,38 @@
$command), $line_nr);
}
+ if ($current->{'parent'}) {
+ if ($current->{'parent'}->{'cmdname'}) {
+ if ($accent_commands{$current->{'parent'}->{'cmdname'}}
+ and !$in_accent_commands{$command}) {
+ _line_warn($self, sprintf($self->__("address@hidden should not
appear in address@hidden"),
+ $command,
$current->{'parent'}->{'cmdname'}),
+ $line_nr);
+ } elsif ((!$in_simple_text_commands{$command}
+ and
($self->{'simple_text_commands'}->{$current->{'parent'}->{'cmdname'}}
+ # following conditions arise because we distinguish
+ # the line arg which are restricted, and the
+ # contents where any command may happen.
+ or ($current->{'type'}
+ and $current->{'type'} eq 'block_line_arg')
+ or ($current->{'type'}
+ and $current->{'type'} eq 'misc_line_arg'
+ and
$root_commands{$current->{'parent'}->{'cmdname'}})))
+ or ($full_text_commands{$current->{'parent'}->{'cmdname'}}
+ and !$in_full_text_commands{$command})) {
+ _line_warn($self, sprintf($self->__("address@hidden should not
appear in address@hidden"),
+ $command,
$current->{'parent'}->{'cmdname'}),
+ $line_nr);
+ }
+ } elsif ($current->{'parent'}->{'type'}
+ and $current->{'parent'}->{'type'} eq 'def_line'
+ and !$in_simple_text_commands{$command}) {
+ _line_warn($self, sprintf($self->__("address@hidden should not
appear in address@hidden"),
+ $command,
$current->{'parent'}->{'parent'}->{'cmdname'}),
+ $line_nr);
+ }
+ }
+
if ($command eq 'end') {
# REMACRO
if ($line =~ s/^\s+([[:alnum:]][[:alnum:]-]*)//) {
@@ -2846,6 +2955,7 @@
$args = [$name];
$self->{'misc_commands'}->{$name.'index'} = 'line';
$self->{'no_paragraph_commands'}->{$name.'index'} = 1;
+ $self->{'simple_text_commands'}->{$name.'index'} = 1;
}
} else {
_line_error ($self, sprintf($self->
Index: t/results/include/double_include.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/include/double_include.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- t/results/include/double_include.pl 21 Oct 2010 22:16:41 -0000 1.4
+++ t/results/include/double_include.pl 23 Oct 2010 10:22:22 -0000 1.5
@@ -67,6 +67,15 @@
'type' => 'warning'
},
{
+ 'error_line' => ':2: warning: @include should not appear in @include
+',
+ 'file_name' => '',
+ 'line_nr' => 2,
+ 'macro' => '',
+ 'text' => '@include should not appear in @include',
+ 'type' => 'warning'
+ },
+ {
'error_line' => 'inc_file.texi:2: @include: Cannot find inc_file.texi In
included file.
',
'file_name' => 't/include//inc_file.texi',
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp TODO Texinfo/Parser.pm t/results/inc...,
Patrice Dumas <=