[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Parser.pm t/60macro.t t...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Parser.pm t/60macro.t t... |
Date: |
Sat, 26 Feb 2011 15:10:21 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/02/26 15:10:21
Modified files:
tp : TODO
tp/Texinfo : Parser.pm
tp/t : 60macro.t
tp/t/results/macro: bad_argument.pl bad_formal_arg.pl
bad_macro_name_with_underscore.pl
macro_no_argument.pl
tp/t/results/value_and_macro: value_in_macro_formal_arg.pl
Added files:
tp/t/results/macro: unknown_macro_on_line_command.pl
Removed files:
tp/t/results/info_tests: html_expanded.pl
Log message:
Flag macros with invalid syntax and don't register them.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.95&r2=1.96
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.209&r2=1.210
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/60macro.t?cvsroot=texinfo&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/info_tests/html_expanded.pl?cvsroot=texinfo&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/bad_argument.pl?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/bad_formal_arg.pl?cvsroot=texinfo&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/bad_macro_name_with_underscore.pl?cvsroot=texinfo&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/macro_no_argument.pl?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/unknown_macro_on_line_command.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/value_and_macro/value_in_macro_formal_arg.pl?cvsroot=texinfo&r1=1.20&r2=1.21
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -b -r1.95 -r1.96
--- TODO 26 Feb 2011 10:52:58 -0000 1.95
+++ TODO 26 Feb 2011 15:10:20 -0000 1.96
@@ -48,6 +48,10 @@
@end menu
lead to Node: Top, Next: (out), Up: (dir)
+An unknwown command in a context where not all commands are accepted leads
+to an error message. There is a FIXME in the code. The test case is
+macro/unknown_macro_on_line_command
+
Force end lines before/after a menu?
With something like
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -b -r1.209 -r1.210
--- Texinfo/Parser.pm 26 Feb 2011 10:52:59 -0000 1.209
+++ Texinfo/Parser.pm 26 Feb 2011 15:10:20 -0000 1.210
@@ -945,6 +945,7 @@
$self->line_error(sprintf($self->__("Bad syntax for address@hidden
argument: %s"),
$command, $args_def),
$line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
}
print STDERR "MACRO address@hidden $macro_name\n" if ($self->{'DEBUG'});
@@ -956,15 +957,18 @@
push @{$macro->{'args'}},
{ 'type' => 'macro_arg', 'text' => $formal_arg,
'parent' => $macro};
+ if ($formal_arg !~ /^[\w\-]+$/) {
$self->line_error(sprintf($self->__("Bad or empty address@hidden formal
argument: %s"),
- $formal_arg), $line_nr)
- if ($formal_arg !~ /^[\w\-]+$/);
+ $formal_arg), $line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
+ }
$macro->{'extra'}->{'args_index'}->{$formal_arg} = $index;
$index++;
}
} else {
$self->line_error (sprintf($self->
__("%c%s requires a name"), ord('@'), $command), $line_nr);
+ $macro->{'extra'}->{'invalid_syntax'} = 1;
}
return $macro;
}
@@ -2706,7 +2710,8 @@
$self->line_warn (sprintf($self->__("here is the previous
definition of `%s'"),
$name),
$self->{'macros'}->{$name}->{'line_nr'});
}
- $self->{'macros'}->{$current->{'args'}->[0]->{'text'}} =
$current;
+ $self->{'macros'}->{$current->{'args'}->[0]->{'text'}} = $current
+ unless ($current->{'extra'}->{'invalid_syntax'});
}
}
$current = $current->{'parent'};
@@ -3108,6 +3113,8 @@
# block command on line command, @xref in @anchor or node...
if ($current->{'parent'}) {
if ($current->{'parent'}->{'cmdname'}) {
+ # FIXME in all the cases below, there is an error message even if
+ #Â the command is an unknown command
if ($accent_commands{$current->{'parent'}->{'cmdname'}}
and !$in_accent_commands{$command}) {
$self->line_warn (sprintf($self->__("address@hidden should not
appear in address@hidden"),
Index: t/60macro.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/60macro.t,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- t/60macro.t 23 Feb 2011 22:12:29 -0000 1.30
+++ t/60macro.t 26 Feb 2011 15:10:20 -0000 1.31
@@ -899,7 +899,10 @@
@end macro
@mac2{}
-']
+'],
+['unknown_macro_on_line_command',
+'@setfilename @begin{}file'
+],
);
Index: t/results/macro/bad_argument.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/macro/bad_argument.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- t/results/macro/bad_argument.pl 19 Feb 2011 13:35:07 -0000 1.18
+++ t/results/macro/bad_argument.pl 26 Feb 2011 15:10:21 -0000 1.19
@@ -17,6 +17,7 @@
'extra' => {
'arg_line' => '
',
+ 'invalid_syntax' => 1,
'macrobody' => 'in macro
'
},
@@ -59,6 +60,7 @@
'extra' => {
'arg_line' => ' bar aaa
',
+ 'invalid_syntax' => 1,
'macrobody' => 'in
'
},
@@ -109,6 +111,7 @@
'args_index' => {
'ggg' => 0
},
+ 'invalid_syntax' => 1,
'macrobody' => 'in macro
'
},
Index: t/results/macro/bad_formal_arg.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/macro/bad_formal_arg.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- t/results/macro/bad_formal_arg.pl 7 Dec 2010 20:34:29 -0000 1.18
+++ t/results/macro/bad_formal_arg.pl 26 Feb 2011 15:10:21 -0000 1.19
@@ -44,6 +44,7 @@
'' => 0,
'not_empty' => 1
},
+ 'invalid_syntax' => 1,
'macrobody' => 'in bad macro
'
},
@@ -100,6 +101,7 @@
'first' => 0,
'in 2arg' => 1
},
+ 'invalid_syntax' => 1,
'macrobody' => 'bad space
'
},
@@ -172,6 +174,7 @@
'args_index' => {
':::' => 0
},
+ 'invalid_syntax' => 1,
'macrobody' => 'in bar
@macro foo {? aaa}
in macro foo
Index: t/results/macro/bad_macro_name_with_underscore.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/macro/bad_macro_name_with_underscore.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/macro/bad_macro_name_with_underscore.pl 19 Feb 2011 13:35:07
-0000 1.1
+++ t/results/macro/bad_macro_name_with_underscore.pl 26 Feb 2011 15:10:21
-0000 1.2
@@ -24,6 +24,7 @@
'extra' => {
'arg_line' => ' the_macro {arg1, arg2}
',
+ 'invalid_syntax' => 1,
'macrobody' => 'In macro
'
},
Index: t/results/macro/macro_no_argument.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/macro/macro_no_argument.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- t/results/macro/macro_no_argument.pl 7 Dec 2010 20:34:30 -0000
1.14
+++ t/results/macro/macro_no_argument.pl 26 Feb 2011 15:10:21 -0000
1.15
@@ -8,7 +8,8 @@
'cmdname' => 'macro',
'contents' => [],
'extra' => {
- 'arg_line' => ''
+ 'arg_line' => '',
+ 'invalid_syntax' => 1
},
'line_nr' => {
'file_name' => '',
Index: t/results/value_and_macro/value_in_macro_formal_arg.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/value_and_macro/value_in_macro_formal_arg.pl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- t/results/value_and_macro/value_in_macro_formal_arg.pl 19 Feb 2011
13:35:07 -0000 1.20
+++ t/results/value_and_macro/value_in_macro_formal_arg.pl 26 Feb 2011
15:10:21 -0000 1.21
@@ -64,6 +64,7 @@
'arg' => 0,
'address@hidden' => 1
},
+ 'invalid_syntax' => 1,
'macrobody' => 'result: @emph{\\arg\\} the \\the\\ thearg \\thearg\\
with value address@hidden
'
},
@@ -90,33 +91,7 @@
'contents' => [
{
'parent' => {},
- 'text' => 'result: '
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'parent' => {},
- 'text' => 'macro_arg1'
- }
- ],
- 'parent' => {},
- 'type' => 'brace_command_arg'
- }
- ],
- 'cmdname' => 'emph',
- 'contents' => [],
- 'line_nr' => {
- 'file_name' => '',
- 'line_nr' => 7,
- 'macro' => 'testvalue'
- },
- 'parent' => {}
- },
- {
- 'parent' => {},
- 'text' => ' the \\the thearg \\thearg with value \\thearg
+ 'text' => 'macro_arg1
'
}
],
@@ -138,10 +113,6 @@
$result_trees{'value_in_macro_formal_arg'}{'contents'}[3]{'parent'} =
$result_trees{'value_in_macro_formal_arg'};
$result_trees{'value_in_macro_formal_arg'}{'contents'}[4]{'parent'} =
$result_trees{'value_in_macro_formal_arg'};
$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[0]{'parent'}
= $result_trees{'value_in_macro_formal_arg'}{'contents'}[5];
-$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[1]{'args'}[0];
-$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[1];
-$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[1]{'parent'}
= $result_trees{'value_in_macro_formal_arg'}{'contents'}[5];
-$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'contents'}[2]{'parent'}
= $result_trees{'value_in_macro_formal_arg'}{'contents'}[5];
$result_trees{'value_in_macro_formal_arg'}{'contents'}[5]{'parent'} =
$result_trees{'value_in_macro_formal_arg'};
$result_texis{'value_in_macro_formal_arg'} = '@set argument arg
@@ -150,13 +121,13 @@
result: @emph{\\arg\\} the \\the\\ thearg \\thearg\\ with value address@hidden
@end macro
-result: @emph{macro_arg1} the \\the thearg \\thearg with value \\thearg
+macro_arg1
';
$result_texts{'value_in_macro_formal_arg'} = '
-result: macro_arg1 the \\the thearg \\thearg with value \\thearg
+macro_arg1
';
$result_errors{'value_in_macro_formal_arg'} = [
@@ -179,30 +150,30 @@
'type' => 'error'
},
{
- 'error_line' => ':7: \\ in macro expansion followed `the\' instead of
parameter name or \\
+ 'error_line' => ':7: Unknown command `testvalue\'
',
'file_name' => '',
'line_nr' => 7,
'macro' => '',
- 'text' => '\\ in macro expansion followed `the\' instead of parameter name
or \\',
+ 'text' => 'Unknown command `testvalue\'',
'type' => 'error'
},
{
- 'error_line' => ':7: \\ in macro expansion followed `thearg\' instead of
parameter name or \\
+ 'error_line' => ':7: Misplaced {
',
'file_name' => '',
'line_nr' => 7,
'macro' => '',
- 'text' => '\\ in macro expansion followed `thearg\' instead of parameter
name or \\',
+ 'text' => 'Misplaced {',
'type' => 'error'
},
{
- 'error_line' => ':7: \\ in macro expansion followed address@hidden'
instead of parameter name or \\
+ 'error_line' => ':7: Misplaced }
',
'file_name' => '',
'line_nr' => 7,
'macro' => '',
- 'text' => '\\ in macro expansion followed address@hidden' instead of
parameter name or \\',
+ 'text' => 'Misplaced }',
'type' => 'error'
}
];
Index: t/results/macro/unknown_macro_on_line_command.pl
===================================================================
RCS file: t/results/macro/unknown_macro_on_line_command.pl
diff -N t/results/macro/unknown_macro_on_line_command.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/macro/unknown_macro_on_line_command.pl 26 Feb 2011 15:10:21
-0000 1.1
@@ -0,0 +1,93 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors);
+
+$result_trees{'unknown_macro_on_line_command'} = {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => ' file',
+ 'type' => 'empty_spaces_after_command'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'setfilename',
+ 'extra' => {
+ 'missing_argument' => 1
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'type' => 'text_root'
+};
+$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0];
+$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'unknown_macro_on_line_command'}{'contents'}[0];
+$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'parent'} =
$result_trees{'unknown_macro_on_line_command'};
+
+$result_texis{'unknown_macro_on_line_command'} = '@setfilename file';
+
+
+$result_texts{'unknown_macro_on_line_command'} = '';
+
+$result_errors{'unknown_macro_on_line_command'} = [
+ {
+ 'error_line' => ':1: warning: @begin should not appear in @setfilename
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@begin should not appear in @setfilename',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => ':1: Unknown command `begin\'
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => 'Unknown command `begin\'',
+ 'type' => 'error'
+ },
+ {
+ 'error_line' => ':1: Misplaced {
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => 'Misplaced {',
+ 'type' => 'error'
+ },
+ {
+ 'error_line' => ':1: Misplaced }
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => 'Misplaced }',
+ 'type' => 'error'
+ },
+ {
+ 'error_line' => ':1: warning: @setfilename missing argument
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@setfilename missing argument',
+ 'type' => 'warning'
+ }
+];
+
+
+1;
Index: t/results/info_tests/html_expanded.pl
===================================================================
RCS file: t/results/info_tests/html_expanded.pl
diff -N t/results/info_tests/html_expanded.pl
--- t/results/info_tests/html_expanded.pl 26 Feb 2011 10:52:59 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,94 +0,0 @@
-use vars qw(%result_texis %result_texts %result_trees %result_errors
- %result_indices %result_sectioning %result_nodes %result_menus
- %result_floats %result_converted %result_converted_errors);
-
-$result_trees{'html_expanded'} = {
- 'contents' => [
- {
- 'contents' => [
- {
- 'parent' => {},
- 'text' => 'Before
-'
- },
- {
- 'cmdname' => 'html',
- 'contents' => [
- {
- 'parent' => {},
- 'text' => '
-',
- 'type' => 'empty_line_after_command'
- },
- {
- 'parent' => {},
- 'text' => 'html
-',
- 'type' => 'raw'
- }
- ],
- 'line_nr' => {
- 'file_name' => '',
- 'line_nr' => 2,
- 'macro' => ''
- },
- 'parent' => {}
- },
- {
- 'parent' => {},
- 'text' => '
-',
- 'type' => 'empty_line_after_command'
- },
- {
- 'parent' => {},
- 'text' => 'after.
-'
- }
- ],
- 'parent' => {},
- 'type' => 'paragraph'
- }
- ],
- 'type' => 'text_root'
-};
-$result_trees{'html_expanded'}{'contents'}[0]{'contents'}[0]{'parent'} =
$result_trees{'html_expanded'}{'contents'}[0];
-$result_trees{'html_expanded'}{'contents'}[0]{'contents'}[1]{'contents'}[0]{'parent'}
= $result_trees{'html_expanded'}{'contents'}[0]{'contents'}[1];
-$result_trees{'html_expanded'}{'contents'}[0]{'contents'}[1]{'contents'}[1]{'parent'}
= $result_trees{'html_expanded'}{'contents'}[0]{'contents'}[1];
-$result_trees{'html_expanded'}{'contents'}[0]{'contents'}[1]{'parent'} =
$result_trees{'html_expanded'}{'contents'}[0];
-$result_trees{'html_expanded'}{'contents'}[0]{'contents'}[2]{'parent'} =
$result_trees{'html_expanded'}{'contents'}[0];
-$result_trees{'html_expanded'}{'contents'}[0]{'contents'}[3]{'parent'} =
$result_trees{'html_expanded'}{'contents'}[0];
-$result_trees{'html_expanded'}{'contents'}[0]{'parent'} =
$result_trees{'html_expanded'};
-
-$result_texis{'html_expanded'} = 'Before
address@hidden
-html
address@hidden html
-after.
-';
-
-
-$result_texts{'html_expanded'} = 'Before
-after.
-';
-
-$result_errors{'html_expanded'} = [];
-
-
-
-$result_converted{'info'}->{'html_expanded'} = 'This is , produced by makeinfo
version 4.13 from .
-
-Before html after.
-';
-
-$result_converted_errors{'info'}->{'html_expanded'} = [
- {
- 'error_line' => 'warning: Document without nodes.
-',
- 'text' => 'Document without nodes.',
- 'type' => 'warning'
- }
-];
-
-
-1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp TODO Texinfo/Parser.pm t/60macro.t t...,
Patrice Dumas <=