[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Parser.pm t/results/misc_com...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Parser.pm t/results/misc_com... |
Date: |
Sun, 03 Oct 2010 15:29:41 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/10/03 15:29:41
Modified files:
tp/Texinfo : Parser.pm
tp/t/results/misc_commands: definfoenclose.pl
tp/t/results/value: bad_syntax.pl
Log message:
Really handle definfoenclose.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/definfoenclose.pl?cvsroot=texinfo&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/value/bad_syntax.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.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- Texinfo/Parser.pm 3 Oct 2010 11:51:36 -0000 1.38
+++ Texinfo/Parser.pm 3 Oct 2010 15:29:41 -0000 1.39
@@ -1277,6 +1277,7 @@
} else {
_line_error ($self, $self->__("Bad syntax for address@hidden"),
$line_nr);
}
+ next;
}
if (defined($deprecated_commands{$command})) {
@@ -1290,6 +1291,8 @@
}
}
+ # special case with @ followed by a newline protecting end of lines
+ # in @def*
last if ($self->{'context_stack'}->[-1] eq 'def' and $command eq "\n");
unless ($self->{'no_paragraph_commands'}->{$command}) {
@@ -1301,6 +1304,7 @@
$current = _end_paragraph($self, $current, $line_nr);
}
+ # commands without braces and not block commands, ie no @end
if (defined($self->{'misc_commands'}->{$command})) {
if ($root_commands{$command}) {
$current = _end_block_command($self, $current, $line_nr);
@@ -1396,6 +1400,9 @@
'parent' => $current->{'contents'}->[-1] };
}
}
+
+ # a container for what is on the @-command line, considered to
+ # be the @-command argument
if (defined($line_arg)) {
$line = $line_arg;
$current = $current->{'contents'}->[-1];
@@ -1411,6 +1418,7 @@
last NEXT_LINE if ($command eq 'bye');
+ # @-command with matching @end
} elsif (exists($block_commands{$command})) {
if ($command eq 'macro' or $command eq 'rmacro') {
my $macro = _parse_macro_command ($self, $command, $line,
@@ -1501,7 +1509,8 @@
last unless ($line =~ /\S/);
}
}
- } elsif ($line =~ s/^{// and (defined($brace_commands{$command}))) {
+ } elsif ($line =~ s/^{// and (defined($brace_commands{$command})
+ or defined($self->{'definfoenclose'}->{$command}))) {
push @{$current->{'contents'}}, { 'cmdname' => $command,
'parent' => $current };
$current = $current->{'contents'}->[-1];
@@ -1517,7 +1526,15 @@
}
$current->{'args'} = [ { 'parent' => $current,
'contents' => [] } ];
- $current->{'remaining_args'} = $brace_commands{$command} -1 if
($brace_commands{$command});
+ $current->{'remaining_args'} = $brace_commands{$command} -1
+ if ($brace_commands{$command});
+ if ($self->{'definfoenclose'}->{$command}) {
+ $current->{'type'} = 'definfoenclose_command';
+ $current->{'special'} = {
+ 'begin' => $self->{'definfoenclose'}->{$command}->[0],
+ 'end' => $self->{'definfoenclose'}->{$command}->[1] };
+ $current->{'remaining_args'} = 0;
+ }
$current = $current->{'args'}->[-1];
# FIXME don't use type to distinguish context_brace_commands.
if ($context_brace_commands{$command}) {
@@ -1576,8 +1593,12 @@
_line_error ($self,
sprintf($self->__("address@hidden expected braces"), $command),
$line_nr);
}
+ } elsif (defined($self->{'definfoenclose'}->{$command})) {
+ _line_error ($self, sprintf($self->__("%c%s expected braces"),
+ ord('@'), $command), $line_nr);
} else {
- # unknown
+ _line_error ($self, sprintf($self->__("Unknown command `%s'"),
+ $command), $line_nr);
}
} elsif ($line =~ s/^([{}@,:\t.])//) {
@@ -1602,12 +1623,13 @@
}
} elsif ($separator eq '}') {
- #_print_current ($current);
+ #print STDERR "GGGGG". _print_current ($current);
if ($current->{'type'} and ($current->{'type'} eq 'bracketed')) {
$current = $current->{'parent'};
} elsif ($current->{'parent'}
and $current->{'parent'}->{'cmdname'}
- and exists
$brace_commands{$current->{'parent'}->{'cmdname'}}) {
+ and (exists
$brace_commands{$current->{'parent'}->{'cmdname'}}
+ or
$self->{'definfoenclose'}->{$current->{'parent'}->{'cmdname'}})) {
if ($context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
pop @{$self->{'context_stack'}};
}
@@ -2001,7 +2023,8 @@
#print STDERR "".Data::Dumper->Dump([$cmd]);
my $arg_nr = 0;
foreach my $arg (@{$cmd->{'args'}}) {
- if (exists($brace_commands{$cmdname})) {
+ if (exists($brace_commands{$cmdname}) or ($cmd->{'type'}
+ and $cmd->{'type'} eq 'definfoenclose_command')) {
$result .= ', ' if ($arg_nr);
$arg_nr++;
} else {
@@ -2174,7 +2197,8 @@
} elsif ($command eq 'definfoenclose') {
if ($line =~ s/^([\w\-]+)\s*,\s*([^\s]+)\s*,\s*([^\s]+)//) {
$args = [$1, $2, $3 ];
- $self->{'info_enclose'}->{$1} = [ $2, $3 ];
+ $self->{'definfoenclose'}->{$1} = [ $2, $3 ];
+ print STDERR "DEFINFOENCLOSE address@hidden: $2, $3\n" if
($self->{'debug'});
} else {
_line_error ($self, sprintf($self->
__("Bad argument to address@hidden"), $command),
$line_nr);
Index: t/results/misc_commands/definfoenclose.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/misc_commands/definfoenclose.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- t/results/misc_commands/definfoenclose.pl 1 Oct 2010 06:50:57 -0000
1.1
+++ t/results/misc_commands/definfoenclose.pl 3 Oct 2010 15:29:41 -0000
1.2
@@ -51,8 +51,30 @@
{
'contents' => [
{
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'bar'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'phoo',
'parent' => {},
- 'text' => 'bar
+ 'remaining_args' => 0,
+ 'special' => {
+ 'begin' => '//',
+ 'end' => '\\'
+ },
+ 'type' => 'definfoenclose_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
'
}
],
@@ -108,8 +130,30 @@
{
'contents' => [
{
+ 'args' => [
+ {
+ 'contents' => [
+ {
'parent' => {},
- 'text' => 'bar
+ 'text' => 'bar'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'phi',
+ 'parent' => {},
+ 'remaining_args' => 0,
+ 'special' => {
+ 'begin' => ':',
+ 'end' => ':'
+ },
+ 'type' => 'definfoenclose_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
'
}
],
@@ -203,7 +247,12 @@
],
'cmdname' => 'strong',
'parent' => {},
- 'remaining_args' => 0
+ 'remaining_args' => 0,
+ 'special' => {
+ 'begin' => '(strong:',
+ 'end' => ':)'
+ },
+ 'type' => 'definfoenclose_command'
},
{
'parent' => {},
@@ -223,7 +272,10 @@
$result_trees{'definfoenclose'}{'contents'}[1]{'contents'}[1]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[1];
$result_trees{'definfoenclose'}{'contents'}[1]{'parent'} =
$result_trees{'definfoenclose'};
$result_trees{'definfoenclose'}{'contents'}[2]{'parent'} =
$result_trees{'definfoenclose'};
+$result_trees{'definfoenclose'}{'contents'}[3]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'definfoenclose'}{'contents'}[3]{'contents'}[0]{'args'}[0];
+$result_trees{'definfoenclose'}{'contents'}[3]{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'definfoenclose'}{'contents'}[3]{'contents'}[0];
$result_trees{'definfoenclose'}{'contents'}[3]{'contents'}[0]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[3];
+$result_trees{'definfoenclose'}{'contents'}[3]{'contents'}[1]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[3];
$result_trees{'definfoenclose'}{'contents'}[3]{'parent'} =
$result_trees{'definfoenclose'};
$result_trees{'definfoenclose'}{'contents'}[4]{'parent'} =
$result_trees{'definfoenclose'};
$result_trees{'definfoenclose'}{'contents'}[5]{'contents'}[0]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[5];
@@ -232,7 +284,10 @@
$result_trees{'definfoenclose'}{'contents'}[5]{'contents'}[1]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[5];
$result_trees{'definfoenclose'}{'contents'}[5]{'parent'} =
$result_trees{'definfoenclose'};
$result_trees{'definfoenclose'}{'contents'}[6]{'parent'} =
$result_trees{'definfoenclose'};
+$result_trees{'definfoenclose'}{'contents'}[7]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'definfoenclose'}{'contents'}[7]{'contents'}[0]{'args'}[0];
+$result_trees{'definfoenclose'}{'contents'}[7]{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'definfoenclose'}{'contents'}[7]{'contents'}[0];
$result_trees{'definfoenclose'}{'contents'}[7]{'contents'}[0]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[7];
+$result_trees{'definfoenclose'}{'contents'}[7]{'contents'}[1]{'parent'} =
$result_trees{'definfoenclose'}{'contents'}[7];
$result_trees{'definfoenclose'}{'contents'}[7]{'parent'} =
$result_trees{'definfoenclose'};
$result_trees{'definfoenclose'}{'contents'}[8]{'parent'} =
$result_trees{'definfoenclose'};
$result_trees{'definfoenclose'}{'contents'}[9]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'definfoenclose'}{'contents'}[9]{'contents'}[0]{'args'}[0];
@@ -252,13 +307,13 @@
$result_trees{'definfoenclose'}{'contents'}[13]{'parent'} =
$result_trees{'definfoenclose'};
$result_texts{'definfoenclose'} = '
-definfoenclose phoo,//,\ @definfoenclose phoo,//,\
+definfoenclose phoo,//,\\ @definfoenclose phoo,//,\\
-bar
address@hidden
definfoenclose phi,:,: @definfoenclose phi,:,:
-bar
address@hidden
@strong{very strong}
@@ -267,25 +322,6 @@
@strong{ is it really strong? }
';
-$result_errors{'definfoenclose'} = [
- {
- 'error_line' => ':4: Misplaced }
-',
- 'file_name' => '',
- 'line_nr' => 4,
- 'macro' => '',
- 'text' => 'Misplaced }',
- 'type' => 'error'
- },
- {
- 'error_line' => ':8: Misplaced }
-',
- 'file_name' => '',
- 'line_nr' => 8,
- 'macro' => '',
- 'text' => 'Misplaced }',
- 'type' => 'error'
- }
-];
+$result_errors{'definfoenclose'} = [];
Index: t/results/value/bad_syntax.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/value/bad_syntax.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/value/bad_syntax.pl 2 Oct 2010 10:03:41 -0000 1.2
+++ t/results/value/bad_syntax.pl 3 Oct 2010 15:29:41 -0000 1.3
@@ -64,16 +64,10 @@
'type' => 'unknown'
},
{
- 'contents' => [
- {
'parent' => {},
'text' => '
'
}
- ],
- 'parent' => {},
- 'type' => 'paragraph'
- }
]
};
$result_trees{'bad_syntax'}{'contents'}[0]{'parent'} =
$result_trees{'bad_syntax'};
@@ -85,7 +79,6 @@
$result_trees{'bad_syntax'}{'contents'}[6]{'contents'}[0]{'parent'} =
$result_trees{'bad_syntax'}{'contents'}[6];
$result_trees{'bad_syntax'}{'contents'}[6]{'parent'} =
$result_trees{'bad_syntax'};
$result_trees{'bad_syntax'}{'contents'}[7]{'parent'} =
$result_trees{'bad_syntax'};
-$result_trees{'bad_syntax'}{'contents'}[9]{'contents'}[0]{'parent'} =
$result_trees{'bad_syntax'}{'contents'}[9];
$result_trees{'bad_syntax'}{'contents'}[9]{'parent'} =
$result_trees{'bad_syntax'};
$result_texts{'bad_syntax'} = '
@@ -146,6 +139,15 @@
'type' => 'error'
},
{
+ 'error_line' => ':7: Misplaced {
+',
+ 'file_name' => '',
+ 'line_nr' => 7,
+ 'macro' => '',
+ 'text' => 'Misplaced {',
+ 'type' => 'error'
+ },
+ {
'error_line' => ':9: warning: undefined flag: unknown
',
'file_name' => '',
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp Texinfo/Parser.pm t/results/misc_com...,
Patrice Dumas <=