[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo Parser.pm
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo Parser.pm |
Date: |
Mon, 04 Oct 2010 22:54:33 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/10/04 22:54:33
Modified files:
tp/Texinfo : Parser.pm
Log message:
Handle @*table and @itemize @-command argument without braces without
looking ahead.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.43&r2=1.44
Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- Parser.pm 4 Oct 2010 22:18:42 -0000 1.43
+++ Parser.pm 4 Oct 2010 22:54:33 -0000 1.44
@@ -1175,10 +1175,10 @@
{ 'text' => $line, 'type' => 'raw', 'parent' => $current };
last;
}
- # in @verb
+ # in @verb. type should be 'brace_command_arg'
} elsif ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
and $current->{'parent'}->{'cmdname'} eq 'verb') {
- # type should be 'brace_command_arg'
+ # collect the first character if not already done
if (!defined($current->{'parent'}->{'type'})) {
if ($line =~ /^$/) {
$current->{'parent'}->{'type'} = '';
@@ -1207,11 +1207,22 @@
(defined($brace_commands{$current->{'cmdname'}}) or
$self->{'definfoenclose'}->{$current->{'cmdname'}})
and $line !~ /^{/) {
+ # special case for @-command as argument of @itemize or @*table.
+ if ($current->{'parent'} and $current->{'parent'}->{'parent'}
+ and $current->{'parent'}->{'parent'}->{'cmdname'} and
+ ($current->{'parent'}->{'parent'}->{'cmdname'} eq 'itemize'
+ or
$item_line_commands{$current->{'parent'}->{'parent'}->{'cmdname'}})
+ and (scalar(@{$current->{'parent'}->{'contents'}}) == 1)) {
+ delete $current->{'contents'};
+ $current->{'type'} = 'command_as_argument';
+ $current = $current->{'parent'};
+ } else {
_line_error ($self,
sprintf($self->__("address@hidden expected braces"),
$current->{'cmdname'}), $line_nr);
$current = $current->{'parent'};
}
+ }
if ($line =~ s/^([^{}@,:\t.]+)//) {
my $new_text = $1;
$current = _merge_text ($self, $current, $new_text);
@@ -1536,11 +1547,8 @@
last unless ($line =~ /\S/);
}
}
- #} elsif ($line =~ s/^{// and (defined($brace_commands{$command})
- # or defined($self->{'definfoenclose'}->{$command}))) {
} elsif (defined($brace_commands{$command})
or defined($self->{'definfoenclose'}->{$command})) {
-
if ($accent_commands{$command} and $line !~ /^{/) {
if ($command =~ /^[a-zA-Z]/) {
$line =~ s/^\s*//;
@@ -1574,16 +1582,6 @@
next;
}
- # special case of a command as argument of *table or itemize
- if ($current->{'parent'} and $current->{'parent'}->{'cmdname'} and
- ($current->{'parent'}->{'cmdname'} eq 'itemize'
- or $item_line_commands{$current->{'parent'}->{'cmdname'}})
- and (scalar(@{$current->{'contents'}}) == 0)
- and $line !~ /^{/) {
- push @{$current->{'contents'}}, {'cmdname' => $command,
- 'parent' => $current,
- 'type' => 'command_as_argument'};
- } else {
push @{$current->{'contents'}}, { 'cmdname' => $command,
'parent' => $current,
'contents' => [] };
@@ -1594,19 +1592,9 @@
'begin' => $self->{'definfoenclose'}->{$command}->[0],
'end' => $self->{'definfoenclose'}->{$command}->[1] };
}
- }
} elsif ($no_brace_commands{$command}) {
push @{$current->{'contents'}},
{ 'cmdname' => $command, 'parent' => $current };
-
- #} elsif(exists $brace_commands{$command}) {
- # } else {
- # _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 {
_line_error ($self, sprintf($self->__("Unknown command `%s'"),
$command), $line_nr);
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/04
- texinfo/tp/Texinfo Parser.pm,
Patrice Dumas <=
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/09
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/14
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/14
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/16
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/18
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/19
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/19
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/24
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/24