[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: |
Thu, 14 Oct 2010 23:11:45 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/10/14 23:11:45
Modified files:
tp/Texinfo : Parser.pm
Log message:
Prepare for taking new text from a file.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.67&r2=1.68
Patches:
Index: Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- Parser.pm 14 Oct 2010 21:27:15 -0000 1.67
+++ Parser.pm 14 Oct 2010 23:11:45 -0000 1.68
@@ -586,7 +586,7 @@
push @$lines_array, [$line, $line_nr];
}
}
- return $self->_internal_parse_text($lines_array);
+ return $self->_internal_parse_text([{'pending' => $lines_array}]);
}
sub tree_to_texi ($);
@@ -947,13 +947,26 @@
sub _next_text($$)
{
- my $text = shift;
+ my $input = shift;
my $line_nr = shift;
- my $new_text = shift @$text;
- if (defined($new_text)) {
+ while (@$input) {
+ my $current = $input->[0];
+ if (@{$current->{'pending'}}) {
+ my $new_text = shift @{$current->{'pending'}};
return ($new_text->[0], $new_text->[1]);
+ } elsif ($current->{'fh'}) {
+ my $fh = $current->{'fh'};
+ my $line = <$fh>;
+ if (defined($line)) {
+ $current->{'line_nr'} ++;
+ return ($line, {'line_nr' => $current->{'line_nr'},
+ 'file_name' => $current->{'name'}});
+ }
}
+ shift(@$input);
+ }
+
return (undef, $line_nr);
}
@@ -1584,9 +1597,10 @@
my $new_lines = _complete_line_nr($expanded_lines,
$line_nr->{'line_nr'}, $line_nr->{'file_name'},
$expanded_macro->{'args'}->[0]->{'text'}, 1);
- unshift @$text, [$line, $line_nr];
- ($line, $line_nr) = _next_text($new_lines, $line_nr);
- unshift @$text, @$new_lines;
+ unshift @{$text->[0]->{'pending'}}, [$line, $line_nr];
+ my $new_text = shift @$new_lines;
+ ($line, $line_nr) = ($new_text->[0], $new_text->[1]);
+ unshift @{$text->[0]->{'pending'}}, @$new_lines;
# Now handle all the cases that may lead to command closing
# or following character association with an @-command, especially
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/04
- texinfo/tp/Texinfo Parser.pm, Patrice Dumas, 2010/10/04
- 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 <=
- 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