[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu... |
Date: |
Sat, 02 Oct 2010 14:28:02 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/10/02 14:28:02
Modified files:
tp/Texinfo : Parser.pm
tp/t : 60macro.t
Added files:
tp/t/results/macro: no_macrobody.pl text_before_after.pl
Log message:
Handle empty macro body.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/60macro.t?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/no_macrobody.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/macro/text_before_after.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- Texinfo/Parser.pm 2 Oct 2010 13:25:07 -0000 1.35
+++ Texinfo/Parser.pm 2 Oct 2010 14:28:01 -0000 1.36
@@ -510,8 +510,10 @@
sub _text_to_lines($)
{
my $text = shift;
+ die if (!defined($text));
my $chomped = chomp($text);
my $lines = [ map {$_."\n"} split (/\n/, $text, -1) ];
+ $lines = [''] if (address@hidden);
chomp($lines->[-1]) unless ($chomped);
return $lines;
}
@@ -1195,7 +1197,6 @@
print STDERR "MACROBODY: $expanded".'||||||'."\n"
if ($self->{'debug'});
my $expanded_lines = _text_to_lines($expanded);
- $expanded_lines = [''] if !(@$expanded_lines);
print STDERR "MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
."\nEND LINES\n" if ($self->{'debug'});
chomp ($expanded_lines->[-1]);
Index: t/60macro.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/60macro.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- t/60macro.t 2 Oct 2010 13:25:08 -0000 1.5
+++ t/60macro.t 2 Oct 2010 14:28:02 -0000 1.6
@@ -13,6 +13,19 @@
@macro bar
in bar
@end macro'],
+['text_before_after',
+'before @macro mymacro
+in macro
address@hidden macro after
+'],
+['no_macrobody',
+'@macro no_macrobody {arg}
address@hidden macro
+
address@hidden line arg
+
address@hidden brace}.
+'],
['empty_end','@macro foo {aaa, }
in foo
@end macro'],
Index: t/results/macro/no_macrobody.pl
===================================================================
RCS file: t/results/macro/no_macrobody.pl
diff -N t/results/macro/no_macrobody.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/macro/no_macrobody.pl 2 Oct 2010 14:28:02 -0000 1.1
@@ -0,0 +1,80 @@
+use vars qw(%result_texts %result_trees %result_errors);
+
+$result_trees{'no_macrobody'} = {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'parent' => {},
+ 'text' => 'no_macrobody',
+ 'type' => 'macro_name'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'arg',
+ 'type' => 'macro_arg'
+ }
+ ],
+ 'cmdname' => 'macro',
+ 'contents' => [],
+ 'parent' => {},
+ 'special' => {
+ 'args_index' => {
+ 'arg' => 0
+ },
+ 'macro_line' => ' no_macrobody {arg}
+',
+ 'macrobody' => ''
+ }
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '.
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ]
+};
+$result_trees{'no_macrobody'}{'contents'}[0]{'args'}[0]{'parent'} =
$result_trees{'no_macrobody'}{'contents'}[0];
+$result_trees{'no_macrobody'}{'contents'}[0]{'args'}[1]{'parent'} =
$result_trees{'no_macrobody'}{'contents'}[0];
+$result_trees{'no_macrobody'}{'contents'}[0]{'parent'} =
$result_trees{'no_macrobody'};
+$result_trees{'no_macrobody'}{'contents'}[1]{'parent'} =
$result_trees{'no_macrobody'};
+$result_trees{'no_macrobody'}{'contents'}[2]{'parent'} =
$result_trees{'no_macrobody'};
+$result_trees{'no_macrobody'}{'contents'}[3]{'parent'} =
$result_trees{'no_macrobody'};
+$result_trees{'no_macrobody'}{'contents'}[4]{'contents'}[0]{'parent'} =
$result_trees{'no_macrobody'}{'contents'}[4];
+$result_trees{'no_macrobody'}{'contents'}[4]{'parent'} =
$result_trees{'no_macrobody'};
+
+$result_texts{'no_macrobody'} = '@macro no_macrobody {arg}
address@hidden macro
+
+
+
+.
+';
+
+$result_errors{'no_macrobody'} = [];
+
+
Index: t/results/macro/text_before_after.pl
===================================================================
RCS file: t/results/macro/text_before_after.pl
diff -N t/results/macro/text_before_after.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/macro/text_before_after.pl 2 Oct 2010 14:28:02 -0000
1.1
@@ -0,0 +1,62 @@
+use vars qw(%result_texts %result_trees %result_errors);
+
+$result_trees{'text_before_after'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'before '
+ },
+ {
+ 'args' => [
+ {
+ 'parent' => {},
+ 'text' => 'mymacro',
+ 'type' => 'macro_name'
+ }
+ ],
+ 'cmdname' => 'macro',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'in macro
+',
+ 'type' => 'raw'
+ }
+ ],
+ 'parent' => {},
+ 'special' => {
+ 'macro_line' => ' mymacro
+',
+ 'macrobody' => 'in macro
+'
+ }
+ },
+ {
+ 'parent' => {},
+ 'text' => ' after
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ }
+ ]
+};
+$result_trees{'text_before_after'}{'contents'}[0]{'contents'}[0]{'parent'} =
$result_trees{'text_before_after'}{'contents'}[0];
+$result_trees{'text_before_after'}{'contents'}[0]{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'text_before_after'}{'contents'}[0]{'contents'}[1];
+$result_trees{'text_before_after'}{'contents'}[0]{'contents'}[1]{'contents'}[0]{'parent'}
= $result_trees{'text_before_after'}{'contents'}[0]{'contents'}[1];
+$result_trees{'text_before_after'}{'contents'}[0]{'contents'}[1]{'parent'} =
$result_trees{'text_before_after'}{'contents'}[0];
+$result_trees{'text_before_after'}{'contents'}[0]{'contents'}[2]{'parent'} =
$result_trees{'text_before_after'}{'contents'}[0];
+$result_trees{'text_before_after'}{'contents'}[0]{'parent'} =
$result_trees{'text_before_after'};
+
+$result_texts{'text_before_after'} = 'before @macro mymacro
+in macro
address@hidden macro
+ after
+';
+
+$result_errors{'text_before_after'} = [];
+
+
- texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu...,
Patrice Dumas <=
- texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu..., Patrice Dumas, 2010/10/06
- texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu..., Patrice Dumas, 2010/10/09
- texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu..., Patrice Dumas, 2010/10/09
- texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu..., Patrice Dumas, 2010/10/09
- texinfo/tp Texinfo/Parser.pm t/60macro.t t/resu..., Patrice Dumas, 2010/10/29