my $i = 0;
use constant {
_rlines_ => $i++,
- _rlines_new_ => $i++,
_rLL_ => $i++,
_Klimit_ => $i++,
_rdepth_of_opening_seqno_ => $i++,
# Basic data structures...
$self->[_rlines_] = []; # = ref to array of lines of the file
- $self->[_rlines_new_] = []; # = ref to array of output lines
# 'rLL' = reference to the continuous liner array of all tokens in a file.
# 'LL' stands for 'Linked List'. Using a linked list was a disaster, but
$is_static_block_comment,
) = @_;
- my $rLL = $self->[_rLL_];
- my $Klimit = $self->[_Klimit_];
- my $ris_bli_container = $self->[_ris_bli_container_];
- my $rseqno_controlling_my_ci = $self->[_rseqno_controlling_my_ci_];
- my $rwant_reduced_ci = $self->[_rwant_reduced_ci_];
- my $rK_weld_left = $self->[_rK_weld_left_];
-
# Find the last code token of this line
my $i_terminal = $iend;
my $terminal_type = $types_to_go[$iend];
$terminal_type = $types_to_go[$i_terminal];
}
}
-
my $terminal_block_type = $block_type_to_go[$i_terminal];
- my $is_outdented_line = 0;
+
+ my $is_outdented_line = 0;
my $type_beg = $types_to_go[$ibeg];
my $token_beg = $tokens_to_go[$ibeg];
- my $block_type_beg = $block_type_to_go[$ibeg];
my $level_beg = $levels_to_go[$ibeg];
+ my $block_type_beg = $block_type_to_go[$ibeg];
my $leading_spaces_beg = $leading_spaces_to_go[$ibeg];
- my $K_beg = $K_to_go[$ibeg];
my $seqno_beg = $type_sequence_to_go[$ibeg];
- my $ibeg_weld_fix = $ibeg;
my $is_closing_type_beg = $is_closing_type{$type_beg};
+
+ my $ris_bli_container = $self->[_ris_bli_container_];
my $is_bli_beg = $seqno_beg ? $ris_bli_container->{$seqno_beg} : 0;
# QW INDENTATION PATCH 3:
);
# Honor any flag to reduce -ci set by the -bbxi=n option
- if ( $seqno_beg && $rwant_reduced_ci->{$seqno_beg} ) {
+ if ( $seqno_beg && $self->[_rwant_reduced_ci_]->{$seqno_beg} ) {
# if this is an opening, it must be alone on the line ...
if ( $is_closing_type{$type_beg} || $ibeg == $i_terminal ) {
# ... or a single welded unit (fix for b1173)
elsif ($total_weld_count) {
+ my $K_beg = $K_to_go[$ibeg];
my $Kterm = $K_to_go[$i_terminal];
- my $Kterm_test = $rK_weld_left->{$Kterm};
+ my $Kterm_test = $self->[_rK_weld_left_]->{$Kterm};
if ( defined($Kterm_test) && $Kterm_test >= $K_beg ) {
$Kterm = $Kterm_test;
}
if ( $is_bli_beg && $is_bli_beg == 1 ) {
my $K_opening_container = $self->[_K_opening_container_];
my $K_opening = $K_opening_container->{$seqno_beg};
+ my $K_beg = $K_to_go[$ibeg];
if ( $K_beg eq $K_opening ) {
$ris_bli_container->{$seqno_beg} = $is_bli_beg = 2;
}
# For -lp formatting use $ibeg_weld_fix to get around the problem
# that with -lp type formatting the opening and closing tokens to not
# have sequence numbers.
+ my $ibeg_weld_fix = $ibeg;
if ( $seqno_qw_closing && $total_weld_count ) {
my $i_plus = $inext_to_go[$ibeg];
if ( $i_plus <= $max_index_to_go ) {
my $K_plus = $K_to_go[$i_plus];
- if ( defined( $rK_weld_left->{$K_plus} ) ) {
+ if ( defined( $self->[_rK_weld_left_]->{$K_plus} ) ) {
$ibeg_weld_fix = $i_plus;
}
}
# if we are at a closing token of some type..
if ( $is_closing_type_beg || $seqno_qw_closing ) {
+ my $K_beg = $K_to_go[$ibeg];
+
# get the indentation of the line containing the corresponding
# opening token
(
# PATCH #2: and not if this token is under -xci control
|| ( $level_jump < 0
&& !$some_closing_token_indentation
- && !$rseqno_controlling_my_ci->{$K_beg} )
+ && !$self->[_rseqno_controlling_my_ci_]->{$K_beg} )
# Patch for -wn=2, multiple welded closing tokens
|| ( $i_terminal > $ibeg
# it is the last token before a level decrease. This will allow
# a closing token to line up with its opening counterpart, and
# avoids an indentation jump larger than 1 level.
+ my $rLL = $self->[_rLL_];
+ my $Klimit = $self->[_Klimit_];
if ( $i_terminal == $ibeg
&& $is_closing_type_beg
&& defined($K_beg)
# and do not undo ci if it was set by the -xci option
$adjust_indentation = 1
if ( $level_next < $lev
- && !$rseqno_controlling_my_ci->{$K_beg} );
+ && !$self->[_rseqno_controlling_my_ci_]->{$K_beg} );
}
# Patch for RT #96101, in which closing brace of anonymous subs
$adjust_indentation = 3;
}
}
- }
+ } ## end if ( $is_closing_type_beg || $seqno_qw_closing )
# if at ');', '};', '>;', and '];' of a terminal qw quote
elsif (