[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: |
Mon, 04 Oct 2010 23:14:51 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/10/04 23:14:51
Modified files:
tp/Texinfo : Parser.pm
tp/t : 02coverage.t
Added files:
tp/t/results/coverage: accents.pl
Log message:
Handle accent commands without looking forward.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/02coverage.t?cvsroot=texinfo&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/accents.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- Texinfo/Parser.pm 4 Oct 2010 22:54:33 -0000 1.44
+++ Texinfo/Parser.pm 4 Oct 2010 23:14:51 -0000 1.45
@@ -1216,6 +1216,39 @@
delete $current->{'contents'};
$current->{'type'} = 'command_as_argument';
$current = $current->{'parent'};
+ } elsif ($accent_commands{$current->{'cmdname'}}) {
+ if ($line =~ /^\s/ and $line !~ /^\n/) {
+ if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
+ $line =~ s/^\s+//;
+ } else {
+ _line_warn ($self, sprintf($self->
+ __("Accent command address@hidden' must not be followed by
whitespace"),
+ $current->{'cmdname'}), $line_nr);
+ $current = $current->{'parent'};
+ }
+ } elsif ($line =~ /^\@/) {
+ _line_error ($self, sprintf($self->
+ __("Use braces to give a command as an argument to
address@hidden"),
+ $current->{'cmdname'}), $line_nr);
+ $current = $current->{'parent'};
+ } elsif ($line =~ s/^(.)//o) {
+ print STDERR "ACCENT address@hidden>{'cmdname'}\n"
+ if ($self->{'debug'});
+ $current->{'args'} = [ { 'text' => $1, 'parent' => $current } ];
+ if ($current->{'cmdname'} =~ /^[a-zA-Z]/) {
+ $current->{'args'}->[-1]->{'type'} = 'space_command_arg';
+ }
+ delete $current->{'contents'};
+ $current = $current->{'parent'};
+ } else { # The accent is at end of line
+ # whitespace for commands with letter.
+ print STDERR "STRANGE ACC address@hidden>{'cmdname'}\n" if
($self->{'debug'});
+ _line_warn ($self, sprintf($self->
+ __("Accent command address@hidden' must not be followed by new
line"),
+ $current->{'cmdname'}), $line_nr);
+ $current = $current->{'parent'};
+ }
+ next;
} else {
_line_error ($self,
sprintf($self->__("address@hidden expected braces"),
@@ -1549,38 +1582,6 @@
}
} elsif (defined($brace_commands{$command})
or defined($self->{'definfoenclose'}->{$command})) {
- if ($accent_commands{$command} and $line !~ /^{/) {
- if ($command =~ /^[a-zA-Z]/) {
- $line =~ s/^\s*//;
- } elsif ($line =~ /^\s/) {
- _line_warn ($self, sprintf($self->
- __("Accent command address@hidden' must not be followed by
whitespace"),
- $command), $line_nr);
- }
- if ($line =~ /^\@/) {
- _line_error ($self, sprintf($self->
- __("Use braces to give a command as an argument to
address@hidden"),
- $command), $line_nr);
- }
- if ($line =~ s/^(\S)//o) {
- print STDERR "ACCENT address@hidden" if ($self->{'debug'});
- my $accent = { 'cmdname' => $command, 'parent' => $current };
- $accent->{'args'} = [ { 'text' => $1, 'parent' => $accent } ];
- if ($command =~ /^[a-zA-Z]/) {
- $accent->{'args'}->[-1]->{'type'} = 'space_command_arg';
- }
- push @{$current->{'contents'}}, $accent;
-
- } else { # The accent is at end of line
- # FIXME warn? And test case? Maybe this is catched
- # above, by "Accent command address@hidden' must not be followed
by
- # whitespace for commands with letter.
- print STDERR "STRANGE ACC address@hidden" if ($self->{'debug'});
- push @{$current->{'contents'}},
- { 'text' => $command, 'parent' => $current };
- }
- next;
- }
push @{$current->{'contents'}}, { 'cmdname' => $command,
'parent' => $current,
Index: t/02coverage.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/02coverage.t,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- t/02coverage.t 26 Sep 2010 18:10:34 -0000 1.11
+++ t/02coverage.t 4 Oct 2010 23:14:51 -0000 1.12
@@ -11,6 +11,16 @@
@majorheading majorheading @b{in b}
'],
+['accents',
+'@ringaccent a
+
+accent at end of line @ringaccent
+accent at end of line and spaces @ringaccent
+
+accent character with spaces @~ following.
+accent character at end of line @~
+
+'],
['block_commands','
@group
in group
Index: t/results/coverage/accents.pl
===================================================================
RCS file: t/results/coverage/accents.pl
diff -N t/results/coverage/accents.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/coverage/accents.pl 4 Oct 2010 23:14:51 -0000 1.1
@@ -0,0 +1,179 @@
+use vars qw(%result_texts %result_trees %result_errors);
+
+$result_trees{'accents'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'parent' => {},
+ 'text' => 'a',
+ 'type' => 'space_command_arg'
+ }
+ ],
+ 'cmdname' => 'ringaccent',
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'accent at end of line '
+ },
+ {
+ 'cmdname' => 'ringaccent',
+ 'contents' => [],
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'accent at end of line and spaces '
+ },
+ {
+ 'cmdname' => 'ringaccent',
+ 'contents' => [],
+ 'parent' => {}
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'accent character with spaces '
+ },
+ {
+ 'cmdname' => '~',
+ 'contents' => [],
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => ' following.
+'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'accent character at end of line '
+ },
+ {
+ 'cmdname' => '~',
+ 'contents' => [],
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'paragraph'
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'normal_line'
+ }
+ ]
+};
+$result_trees{'accents'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'} =
$result_trees{'accents'}{'contents'}[0]{'contents'}[0];
+$result_trees{'accents'}{'contents'}[0]{'contents'}[0]{'parent'} =
$result_trees{'accents'}{'contents'}[0];
+$result_trees{'accents'}{'contents'}[0]{'contents'}[1]{'parent'} =
$result_trees{'accents'}{'contents'}[0];
+$result_trees{'accents'}{'contents'}[0]{'parent'} = $result_trees{'accents'};
+$result_trees{'accents'}{'contents'}[1]{'parent'} = $result_trees{'accents'};
+$result_trees{'accents'}{'contents'}[2]{'contents'}[0]{'parent'} =
$result_trees{'accents'}{'contents'}[2];
+$result_trees{'accents'}{'contents'}[2]{'contents'}[1]{'parent'} =
$result_trees{'accents'}{'contents'}[2];
+$result_trees{'accents'}{'contents'}[2]{'contents'}[2]{'parent'} =
$result_trees{'accents'}{'contents'}[2];
+$result_trees{'accents'}{'contents'}[2]{'contents'}[3]{'parent'} =
$result_trees{'accents'}{'contents'}[2];
+$result_trees{'accents'}{'contents'}[2]{'contents'}[4]{'parent'} =
$result_trees{'accents'}{'contents'}[2];
+$result_trees{'accents'}{'contents'}[2]{'parent'} = $result_trees{'accents'};
+$result_trees{'accents'}{'contents'}[3]{'parent'} = $result_trees{'accents'};
+$result_trees{'accents'}{'contents'}[4]{'contents'}[0]{'parent'} =
$result_trees{'accents'}{'contents'}[4];
+$result_trees{'accents'}{'contents'}[4]{'contents'}[1]{'parent'} =
$result_trees{'accents'}{'contents'}[4];
+$result_trees{'accents'}{'contents'}[4]{'contents'}[2]{'parent'} =
$result_trees{'accents'}{'contents'}[4];
+$result_trees{'accents'}{'contents'}[4]{'contents'}[3]{'parent'} =
$result_trees{'accents'}{'contents'}[4];
+$result_trees{'accents'}{'contents'}[4]{'contents'}[4]{'parent'} =
$result_trees{'accents'}{'contents'}[4];
+$result_trees{'accents'}{'contents'}[4]{'contents'}[5]{'parent'} =
$result_trees{'accents'}{'contents'}[4];
+$result_trees{'accents'}{'contents'}[4]{'parent'} = $result_trees{'accents'};
+$result_trees{'accents'}{'contents'}[5]{'parent'} = $result_trees{'accents'};
+
+$result_texts{'accents'} = '@ringaccent a
+
+accent at end of line @ringaccent
+accent at end of line and spaces @ringaccent
+accent character with spaces @~ following.
+accent character at end of line @~
+
+';
+
+$result_errors{'accents'} = [
+ {
+ 'error_line' => ':3: warning: Accent command address@hidden' must not be
followed by new line
+',
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => '',
+ 'text' => 'Accent command address@hidden' must not be followed by new
line',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => ':4: warning: Accent command address@hidden' must not be
followed by new line
+',
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => '',
+ 'text' => 'Accent command address@hidden' must not be followed by new
line',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => ':6: warning: Accent command address@hidden' must not be
followed by whitespace
+',
+ 'file_name' => '',
+ 'line_nr' => 6,
+ 'macro' => '',
+ 'text' => 'Accent command address@hidden' must not be followed by
whitespace',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => ':7: warning: Accent command address@hidden' must not be
followed by new line
+',
+ 'file_name' => '',
+ 'line_nr' => 7,
+ 'macro' => '',
+ 'text' => 'Accent command address@hidden' must not be followed by new
line',
+ 'type' => 'warning'
+ }
+];
+
+
- texinfo/tp Texinfo/Parser.pm t/02coverage.t t/r...,
Patrice Dumas <=