[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Parser.pm t/02coverage.t t/r...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Parser.pm t/02coverage.t t/r... |
Date: |
Sat, 25 Sep 2010 14:33:39 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/09/25 14:33:39
Modified files:
tp/Texinfo : Parser.pm
tp/t : 02coverage.t
tp/t/results/columnfractions: empty.pl empty_comment.pl good.pl
good_comment.pl
good_space_comment.pl
not_fraction.pl wrong_command.pl
Added files:
tp/t/results/coverage: block_commands.pl
Log message:
Test simple block commands.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/02coverage.t?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/empty.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/empty_comment.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/good.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/good_comment.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/good_space_comment.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/not_fraction.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/columnfractions/wrong_command.pl?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/block_commands.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- Texinfo/Parser.pm 25 Sep 2010 13:58:21 -0000 1.14
+++ Texinfo/Parser.pm 25 Sep 2010 14:33:35 -0000 1.15
@@ -167,10 +167,16 @@
foreach my $block_command(
'menu', 'detailmenu', 'direntry',
'cartouche', 'group', 'raggedright', 'flushleft', 'flushright',
- 'titlepage', 'copying', 'documentdescription',
+ 'titlepage', 'copying', 'documentdescription') {
+ $block_commands{$block_command} = 0;
+}
+
+my %preformatted_commands;
+foreach my $preformatted_command(
'example', 'smallexample', 'display', 'smalldisplay', 'lisp',
'smalllisp', 'format', 'smallformat') {
- $block_commands{$block_command} = 0;
+ $block_commands{$preformatted_command} = 0;
+ $preformatted_commands{$preformatted_command} = 1;
}
# macro is special
@@ -711,6 +717,7 @@
my $error = $self->_line_error(
sprintf($self->__("No matching `%cend %s'"),
ord('@'), $current->{'cmdname'}), $line_nr);
+ pop @{$self->{'context'}} if
($preformatted_commands{$current->{'cmdname'}});
$current = $current->{'parent'};
} elsif ($current->{'parent'}->{'cmdname'}
and exists
$context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
@@ -725,9 +732,11 @@
return ($current, $error) if ($error);
}
- $current = $current->{'parent'}
if ($command and $current->{'cmdname'}
- and $current->{'cmdname'} eq $command);
+ and $current->{'cmdname'} eq $command) {
+ pop @{$self->{'context'}} if
($preformatted_commands{$current->{'cmdname'}});
+ $current = $current->{'parent'}
+ }
return ($current, 0);
}
@@ -1005,14 +1014,16 @@
'contents' => [] };
$current = $parent->{'contents'}->[-1];
} else {
- $self->_line_error (sprintf($self->__("address@hidden not
meaningful inside address@hidden' block"), $command, $parent->{'cmdname'}),
$line_nr);
+ return undef if $self->_line_error
(sprintf($self->__("address@hidden not meaningful inside address@hidden'
block"), $command, $parent->{'cmdname'}), $line_nr);
}
# *table
} elsif ($parent = _item_line_parent($current)) {
if ($command eq 'item' or $command eq 'itemx') {
+ push @{$current->{'contents'}},
+ { 'cmdname' => $command, 'parent' => $current };
$line_arg = $line;
} else {
- $self->_line_error (sprintf($self->__("address@hidden not
meaningful inside address@hidden' block"), $command, $parent->{'cmdname'}),
$line_nr);
+ return undef if $self->_line_error
(sprintf($self->__("address@hidden not meaningful inside address@hidden'
block"), $command, $parent->{'cmdname'}), $line_nr);
}
# multitable
} elsif ($parent = _item_multitable_parent($current)) {
@@ -1043,12 +1054,12 @@
$current = $row->{'contents'}->[-1];
}
} else {
- $self->_line_error (sprintf($self->__("address@hidden not
meaningful inside address@hidden' block"), $command, $parent->{'cmdname'}),
$line_nr);
+ return undef if $self->_line_error
(sprintf($self->__("address@hidden not meaningful inside address@hidden'
block"), $command, $parent->{'cmdname'}), $line_nr);
}
} elsif ($command eq 'tab') {
- $self->line_error($self->__("ignoring address@hidden outside of
multitable"), $line_nr);
+ return undef if $self->_line_error($self->__("ignoring
address@hidden outside of multitable"), $line_nr);
} else {
- $self->line_error (sprintf($self->__("address@hidden outside of
table or list"), $command), $line_nr);
+ return undef if $self->_line_error
(sprintf($self->__("address@hidden outside of table or list"), $command),
$line_nr);
}
} else {
push @{$current->{'contents'}},
@@ -1087,7 +1098,8 @@
return undef if ($error);
$line =~ s/\s*//;
push @{$current->{'contents'}}, { 'cmdname' => $command,
- 'parent' => $current };
+ 'parent' => $current,
+ 'contents' => [] };
$current = $current->{'contents'}->[-1];
if ($block_commands{$command} and
$block_commands{$command} =~ /^\d+$/) {
@@ -1118,6 +1130,8 @@
'contents' => [] } ];
$current = $current->{'args'}->[-1];
#push @{$self->{'context'}}, 'def';
+ } elsif ($preformatted_commands{$command}) {
+ push @{$self->{'context'}}, 'preformatted';
} else {
last unless ($line =~ /\S/);
}
@@ -1142,8 +1156,7 @@
'contents' => [] } ];
$current->{'remaining_args'} = $brace_commands{$command} -1 if
($brace_commands{$command});
$current = $current->{'args'}->[-1];
- # no type for footnote, such that it appears as a container
- # that holds paragraphs
+ # FIXME don't use type to distinguish context_brace_commands.
if ($context_brace_commands{$command}) {
push @{$self->{'context'}}, $command;
} else {
@@ -1404,6 +1417,7 @@
and defined($cmd->{'args'})) {
die "bad args type (".ref($cmd->{'args'}).") $cmd->{'args'}\n"
if (ref($cmd->{'args'}) ne 'ARRAY');
+ $result .= ' ';
foreach my $arg (@{$cmd->{'args'}}) {
$result .= tree_to_texi ($arg) . ', ';
}
Index: t/02coverage.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/02coverage.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- t/02coverage.t 25 Sep 2010 10:01:34 -0000 1.5
+++ t/02coverage.t 25 Sep 2010 14:33:37 -0000 1.6
@@ -11,8 +11,6 @@
@majorheading majorheading @b{in b}
'],
-);
-my @todo = (
['block_commands','
@group
in group
@@ -25,18 +23,14 @@
@float a float, b float
In float
address@hidden asis
address@hidden table item
address@hidden table itemx
-
-In table
address@hidden table
@caption{in caption
in caption}
@end float
-
+'],);
+my @todo = (
+['item_container','
@itemize +
@item i--tem +
@end itemize
@@ -45,7 +39,16 @@
@item
b--ullet
@end itemize
+'],
+['table','
address@hidden asis
address@hidden table item
address@hidden table itemx
+In table
address@hidden table
+'],
+['multitable','
@multitable @columnfractions 6 7
@headitem mu--ltitable headitem @tab another tab
@item mu--ltitable item @tab multitable tab
Index: t/results/columnfractions/empty.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/columnfractions/empty.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/empty.pl 25 Sep 2010 13:58:21 -0000 1.2
+++ t/results/columnfractions/empty.pl 25 Sep 2010 14:33:38 -0000 1.3
@@ -10,6 +10,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 0
Index: t/results/columnfractions/empty_comment.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/columnfractions/empty_comment.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/empty_comment.pl 25 Sep 2010 13:58:21 -0000
1.2
+++ t/results/columnfractions/empty_comment.pl 25 Sep 2010 14:33:39 -0000
1.3
@@ -22,6 +22,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 0
Index: t/results/columnfractions/good.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/results/columnfractions/good.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/good.pl 25 Sep 2010 13:58:21 -0000 1.2
+++ t/results/columnfractions/good.pl 25 Sep 2010 14:33:39 -0000 1.3
@@ -27,6 +27,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 3
Index: t/results/columnfractions/good_comment.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/columnfractions/good_comment.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/good_comment.pl 25 Sep 2010 13:58:21 -0000
1.2
+++ t/results/columnfractions/good_comment.pl 25 Sep 2010 14:33:39 -0000
1.3
@@ -39,6 +39,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 3
Index: t/results/columnfractions/good_space_comment.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/columnfractions/good_space_comment.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/good_space_comment.pl 25 Sep 2010 13:58:21
-0000 1.2
+++ t/results/columnfractions/good_space_comment.pl 25 Sep 2010 14:33:39
-0000 1.3
@@ -34,6 +34,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 2
Index: t/results/columnfractions/not_fraction.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/columnfractions/not_fraction.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/not_fraction.pl 25 Sep 2010 13:58:21 -0000
1.2
+++ t/results/columnfractions/not_fraction.pl 25 Sep 2010 14:33:39 -0000
1.3
@@ -10,6 +10,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 0
Index: t/results/columnfractions/wrong_command.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/columnfractions/wrong_command.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- t/results/columnfractions/wrong_command.pl 25 Sep 2010 13:58:21 -0000
1.2
+++ t/results/columnfractions/wrong_command.pl 25 Sep 2010 14:33:39 -0000
1.3
@@ -32,6 +32,7 @@
}
],
'cmdname' => 'multitable',
+ 'contents' => [],
'parent' => {},
'special' => {
'max_columns' => 0
Index: t/results/coverage/block_commands.pl
===================================================================
RCS file: t/results/coverage/block_commands.pl
diff -N t/results/coverage/block_commands.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/coverage/block_commands.pl 25 Sep 2010 14:33:39 -0000
1.1
@@ -0,0 +1,220 @@
+use vars qw(%result_texts %result_trees %result_errors);
+
+$result_trees{'block_commands'} = {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'cmdname' => 'group',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'in group
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ],
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'warning
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'quotation',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'in quotation
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ],
+ 'parent' => {},
+ 'remaining_args' => 0
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'a float'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'block_line_arg'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'b float
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'float',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'In float
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'in caption
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'in caption'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ],
+ 'parent' => {}
+ }
+ ],
+ 'cmdname' => 'caption',
+ 'parent' => {},
+ 'remaining_args' => 0
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+'
+ }
+ ],
+ 'parent' => {},
+ 'remaining_args' => 0
+ }
+ ]
+};
+$result_trees{'block_commands'}{'contents'}[0]{'parent'} =
$result_trees{'block_commands'};
+$result_trees{'block_commands'}{'contents'}[1]{'contents'}[0]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[1]{'contents'}[0];
+$result_trees{'block_commands'}{'contents'}[1]{'contents'}[0]{'parent'} =
$result_trees{'block_commands'}{'contents'}[1];
+$result_trees{'block_commands'}{'contents'}[1]{'parent'} =
$result_trees{'block_commands'};
+$result_trees{'block_commands'}{'contents'}[2]{'parent'} =
$result_trees{'block_commands'};
+$result_trees{'block_commands'}{'contents'}[3]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[3]{'args'}[0];
+$result_trees{'block_commands'}{'contents'}[3]{'args'}[0]{'parent'} =
$result_trees{'block_commands'}{'contents'}[3];
+$result_trees{'block_commands'}{'contents'}[3]{'contents'}[0]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[3]{'contents'}[0];
+$result_trees{'block_commands'}{'contents'}[3]{'contents'}[0]{'parent'} =
$result_trees{'block_commands'}{'contents'}[3];
+$result_trees{'block_commands'}{'contents'}[3]{'parent'} =
$result_trees{'block_commands'};
+$result_trees{'block_commands'}{'contents'}[4]{'parent'} =
$result_trees{'block_commands'};
+$result_trees{'block_commands'}{'contents'}[5]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'args'}[0];
+$result_trees{'block_commands'}{'contents'}[5]{'args'}[0]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'args'}[1]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'args'}[1];
+$result_trees{'block_commands'}{'contents'}[5]{'args'}[1]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'contents'}[0];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[0]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[1]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[2]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[1]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[2]{'contents'}[0]{'parent'}
=
$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[2];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[2]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'args'}[0]{'parent'}
= $result_trees{'block_commands'}{'contents'}[5]{'contents'}[3];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[3]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'contents'}[4]{'parent'} =
$result_trees{'block_commands'}{'contents'}[5];
+$result_trees{'block_commands'}{'contents'}[5]{'parent'} =
$result_trees{'block_commands'};
+
+$result_texts{'block_commands'} = '
address@hidden
+in group
address@hidden group
+
address@hidden warning
+in quotation
address@hidden quotation
+
address@hidden a float, b float
+In float
+
+
address@hidden caption
+
+in caption}
address@hidden float
+';
+
+$result_errors{'block_commands'} = [];
+
+
- texinfo/tp Texinfo/Parser.pm t/02coverage.t t/r...,
Patrice Dumas <=