};
my $K_end_q = sub {
- my ($KK) = @_;
- my $Num = @{$rLL};
+ my ($KK) = @_;
my $K_end = $KK;
my $Kn = $KK + 1;
- if ( $Kn < $Num && $rLL->[$Kn]->[_TYPE_] eq 'b' ) { $Kn += 1 }
+ if ( $Kn <= $Kmax && $rLL->[$Kn]->[_TYPE_] eq 'b' ) { $Kn += 1 }
- while ( $Kn < $Num && $rLL->[$Kn]->[_TYPE_] eq 'q' ) {
+ while ( $Kn <= $Kmax && $rLL->[$Kn]->[_TYPE_] eq 'q' ) {
$K_end = $Kn;
$Kn += 1;
- if ( $Kn < $Num && $rLL->[$Kn]->[_TYPE_] eq 'b' ) { $Kn += 1 }
+ if ( $Kn <= $Kmax && $rLL->[$Kn]->[_TYPE_] eq 'b' ) { $Kn += 1 }
}
return $K_end;
$previous_nonblank_token_2 = $rLL_new->[$Kpp]->[_TOKEN_];
}
- my $Kn = $self->K_next_nonblank($KK);
my $next_nonblank_token = "";
- if ( defined($Kn) ) {
+ my $Kn = $KK + 1;
+ if ( $Kn <= $Kmax && $rLL->[$Kn]->[_TYPE_] eq 'b' ) { $Kn += 1 }
+ if ( $Kn <= $Kmax ) {
$next_nonblank_token = $rLL->[$Kn]->[_TOKEN_];
}
my $rLL = $self->[_rLL_];
return unless ( defined($rLL) && @{$rLL} );
+ my $Num = @{$rLL};
my $K_opening_container = $self->[_K_opening_container_];
my $K_closing_container = $self->[_K_closing_container_];
my $K_inner_closing = $K_closing_container->{$inner_seqno};
# See if it is immediately followed by another, outer closing token
- my $K_outer_closing = $self->K_next_nonblank($K_inner_closing);
- next unless ( defined($K_outer_closing) );
+ my $K_outer_closing = $K_inner_closing + 1;
+ $K_outer_closing += 1
+ if ( $K_outer_closing < $Num
+ && $rLL->[$K_outer_closing]->[_TYPE_] eq 'b' );
+
+ next unless ( $K_outer_closing < $Num );
my $outer_seqno = $rLL->[$K_outer_closing]->[_TYPE_SEQUENCE_];
next unless ($outer_seqno);
my $token_outer_closing = $rLL->[$K_outer_closing]->[_TOKEN_];
my $rLL = $self->[_rLL_];
return unless ( defined($rLL) && @{$rLL} );
+ my $Num = @{$rLL};
my $K_opening_container = $self->[_K_opening_container_];
my $K_closing_container = $self->[_K_closing_container_];
if ( $is_opening_token{$token} ) {
# see if the next token is a quote of some type
- my $Kn = $self->K_next_nonblank($KK);
- next unless $Kn;
+ my $Kn = $KK + 1;
+ $Kn += 1
+ if ( $Kn < $Num && $rLL->[$Kn]->[_TYPE_] eq 'b' );
+ next unless ( $Kn < $Num );
+
my $next_token = $rLL->[$Kn]->[_TOKEN_];
my $next_type = $rLL->[$Kn]->[_TYPE_];
next
return unless ( $token eq '{' && $block_type );
# followed by a comment
- my $K_sc = $self->K_next_nonblank($KK);
- return unless defined($K_sc);
+ my $K_sc = $KK + 1;
+ $K_sc += 1
+ if ( $K_sc <= $Kmax && $rLL->[$K_sc]->[_TYPE_] eq 'b' );
+ return unless ( $K_sc <= $Kmax );
my $type_sc = $rLL->[$K_sc]->[_TYPE_];
return unless ( $type_sc eq '#' );