my $rbreak_after_Klast = $self->[_rbreak_after_Klast_];
my $rbreak_container = $self->[_rbreak_container_];
my $K_opening_container = $self->[_K_opening_container_];
- my $ris_broken_container = $self->[_ris_broken_container_];
my $ris_list_by_seqno = $self->[_ris_list_by_seqno_];
#----------------------------------------
return unless ( defined($rLL) && @{$rLL} );
my $rbreak_container = $self->[_rbreak_container_];
+ my $ris_broken_container = $self->[_ris_broken_container_];
my $ris_cuddled_closing_brace = $self->[_ris_cuddled_closing_brace_];
my $K_opening_container = $self->[_K_opening_container_];
my $K_closing_container = $self->[_K_closing_container_];
- my $is_broken_block = sub {
-
- # a block is broken if the input line numbers of the braces differ
- # we can only cuddle between broken blocks
- my ($seqno) = @_;
- my $K_opening = $K_opening_container->{$seqno};
- return unless ( defined($K_opening) );
- my $K_closing = $K_closing_container->{$seqno};
- return unless ( defined($K_closing) );
- return $rbreak_container->{$seqno}
- || $rLL->[$K_closing]->[_LINE_INDEX_] !=
- $rLL->[$K_opening]->[_LINE_INDEX_];
- };
-
# A stack to remember open chains at all levels: This is a hash rather than
# an array for safety because negative levels can occur in files with
# errors. This allows us to keep processing with negative levels.
# The preceding block must be on multiple lines so that its
# closing brace will start a new line.
- if ( !$is_broken_block->($closing_seqno) ) {
+ if ( !$ris_broken_container->{$closing_seqno}
+ && !$rbreak_container->{$closing_seqno} )
+ {
next unless ( $CBO == 2 );
$rbreak_container->{$closing_seqno} = 1;
}
my $K_opening_container = $self->[_K_opening_container_];
my $K_closing_container = $self->[_K_closing_container_];
my $rbreak_container = $self->[_rbreak_container_];
+ my $ris_broken_container = $self->[_ris_broken_container_];
my $rshort_nested = $self->[_rshort_nested_];
my $rlines = $self->[_rlines_];
my $rblock_type_of_seqno = $self->[_rblock_type_of_seqno_];
return ($excess_length);
};
- my $is_broken_block = sub {
-
- # a block is broken if the input line numbers of the braces differ
- my ($seqno) = @_;
- my $K_opening = $K_opening_container->{$seqno};
- return unless ( defined($K_opening) );
- my $K_closing = $K_closing_container->{$seqno};
- return unless ( defined($K_closing) );
- return $rbreak_container->{$seqno}
- || $rLL->[$K_closing]->[_LINE_INDEX_] !=
- $rLL->[$K_opening]->[_LINE_INDEX_];
- };
-
# loop over all containers
my @open_block_stack;
my $iline = -1;
next unless ( defined($K_opening) && defined($K_closing) );
# require that this block be entirely on one line
- next if ( $is_broken_block->($type_sequence) );
+ next
+ if ( $ris_broken_container->{$type_sequence}
+ || $rbreak_container->{$type_sequence} );
# See if this block fits on one line of allowed length (which may
# be different from the input script)