$inext = $rLL->[$Knext]->[_LINE_INDEX_];
}
- my $get_inext = sub {
- if ( $Knext < 0 || $Knext > $Kmax ) { $inext = undef }
- else {
- $inext = $rLL->[$Knext]->[_LINE_INDEX_];
- }
- return $inext;
- };
-
# Remember the most recently output token index
my $Klast_out;
my @K_array;
my $rK_range;
- $inext = $get_inext->();
- while ( defined($inext) && $inext <= $iline ) {
- push @{K_array}, $Knext;
- $Knext += 1;
- $inext = $get_inext->();
+ if ( $Knext <= $Kmax ) {
+ $inext = $rLL->[$Knext]->[_LINE_INDEX_];
+ while ( $inext <= $iline ) {
+ push @{K_array}, $Knext;
+ $Knext += 1;
+ if ( $Knext > $Kmax ) {
+ $inext = undef;
+ last;
+ }
+ $inext = $rLL->[$Knext]->[_LINE_INDEX_];
+ }
}
# Delete any terminal blank token
};
foreach my $KK ( 0 .. $Kmax ) {
+ my $num = @seqno_stack;
my $seqno = $rLL->[$KK]->[_TYPE_SEQUENCE_];
- my $num = @seqno_stack;
if ($seqno) {
my $token = $rLL->[$KK]->[_TOKEN_];
if ( $token eq '{' && $is_non_indenting_brace->($KK) ) {
$num -= 1;
}
}
+ next unless $num;
$radjusted_levels->[$KK] -= $num;
}
return;
my ( $raw_tok, $lev, $tag, $tok_count ) =
decode_alignment_token($tok);
- if ( $tok !~ /^[#]$/ ) {
+ if ( $tok ne '#' ) {
if ( !defined($lev_min) ) {
$lev_min = $lev;
$lev_max = $lev;
if ( $token_line_count{$tok} == $nlines ) {
if ( $tok =~ /^\?/ || $tok =~ /^\{\d+if/ ) {
$is_full_block = 1;
+ last;
}
}
}
sub get_output_line_number {
- # the output line number reported to a caller is the number of items
- # written plus the number of items in the buffer
- my $self = shift;
- my $nlines = $self->group_line_count();
- my $file_writer_object = $self->[_file_writer_object_];
- return $nlines + $file_writer_object->get_output_line_number();
+ # The output line number reported to a caller =
+ # the number of items still in the buffer +
+ # the number of items written.
+ return $_[0]->group_line_count() +
+ $_[0]->[_file_writer_object_]->get_output_line_number();
}
###############################