$rOpts->{'closing-side-comment-interval'} = 100_000_000;
}
}
+ else {
+ ## ok - no -csc issues
+ }
make_bli_pattern();
initialize_line_up_parentheses_control_hash(
$rOpts->{'line-up-parentheses-inclusion-list'}, 'lpil' );
}
+ else {
+ ## ok - neither -lpxl nor -lpil
+ }
return;
} ## end sub check_options
}
# Check for valid flag1
- if ( !defined($flag1) ) { $flag1 = '*' }
- elsif ( $flag1 !~ /^[kKfFwW\*]$/ ) {
+ if ( !defined($flag1) ) { $flag1 = '*' }
+
+ if ( $flag1 !~ /^[kKfFwW\*]$/ ) {
$msg1 .= " '$item_save'";
next;
}
# 1 all containers with sublists match
# 2 all containers with sublists, code blocks or ternary operators match
# ... this could be extended in the future
- if ( !defined($flag2) ) { $flag2 = 0 }
- elsif ( $flag2 !~ /^[012]$/ ) {
+ if ( !defined($flag2) ) { $flag2 = 0 }
+
+ if ( $flag2 !~ /^[012]$/ ) {
$msg1 .= " '$item_save'";
next;
}
elsif ( $short_name eq 'kba' ) {
@list = grep { !m/[\)\]\}\?\:]/ } @list;
}
+ else {
+ Fault(<<EOM);
+Bad call arg - received short name '$short_name' but expecting 'kbb' or 'kba'
+EOM
+ }
# pull out any any leading container code, like f( or *{
# For example: 'f(' becomes flags hash entry '(' => 'f'
Unknown flag '$flag' given for '$key' in '$short_name'
EOM
}
+ else {
+ ## ok - no error seen
+ }
$rkeep_break_hash->{$key} = $flag;
}
$ws = WS_NO;
}
}
+ else {
+ # ok
+ }
} ## end elsif ( $is_special_ws_type{$type} ...
#---------------------------------------------------------------
{
$ws = WS_NO;
}
+ else {
+ ## ok - not covered by a special '(' rule
+ }
}
# patch for SWITCH/CASE: make space at ']{' optional
elsif ( ( $token eq '{' && $type ne 'L' ) && $last_token eq ']' ) {
$ws = WS_OPTIONAL;
}
+ else {
+ ## ok - not covered by a special rule
+ }
# keep space between 'sub' and '{' for anonymous sub definition,
# be sure type = 'k' (added for c140)
$block_type_for_tightness{$seqno} = $last_token;
}
}
- } ## end if ( $is_opening_type{$type} ) {
+ } ## end elsif ( $is_opening_type{$type} ) {
+
+ else {
+ ## ok - not covered by a special rule
+ }
# always preserve whatever space was used after a possible
# filehandle (except _) or here doc operator
elsif ( $token eq 'ne' or $token eq 'eq' ) {
$bsr = NOMINAL;
}
+ else {
+ ## ok - not special
+ }
# set terminal bond strength to the nominal value
# this will cause good preceding breaks to be retained
elsif ( $is_lt_gt_le_ge{$next_nonblank_token} ) {
$bsl = 0.9 * NOMINAL + 0.1 * STRONG;
}
+ else {
+ ## ok - not special
+ }
# Use the minimum of the left and right strengths. Note: it might
# seem that we would want to keep a NO_BREAK if either token has
elsif ( $next_nonblank_type eq '=>' ) {
if ( $bond_str < STRONG ) { $bond_str = STRONG }
}
+ else {
+ ## ok - not special
+ }
#---------------------------------------------------------------
# Additional hardwired NOBREAK rules
$bond_str = NO_BREAK;
}
}
+ else {
+ ## ok - not special
+ }
# Breaking before a ? before a quote can cause trouble if
# they are not separated by a blank.
&& substr( $next_nonblank_token, 0, 1 ) eq '/'
&& $next_nonblank_type ne '//' );
}
+ else {
+ ## ok - not special
+ }
$bond_str_2 = $bond_str if (DEBUG_BOND);
{
$strength -= 1;
}
+ else {
+ ## ok - not welded left or right
+ }
}
# always break after side comment
elsif ( $block_type =~ /$SUB_PATTERN/ ) {
$self->[_ris_sub_block_]->{$seqno} = 1;
}
+ else {
+ ## ok - not a sub
+ }
return;
} ## end sub store_block_type
elsif ( $is_mccabe_logic_operator{$type} ) {
$count++;
}
+ else {
+ ## ok - not a mccabe operator
+ }
}
$rmccabe_count_sum->{ $Klimit + 1 } = $count;
return $rmccabe_count_sum;
# Count all other special line types except pod;
# For a list of line types see sub 'process_all_lines'
elsif ( $line_type !~ /^POD/ ) { $code_line_count++ }
+ else {
+ ## ok - not CODE and not POD
+ }
# Store the cumulative count using the input line index
$rcode_line_count->[$ix_line] = $code_line_count;
$is_logical ||=
$rparent->{_container_type} eq 'Logical';
}
+ else {
+ ## ok - none of the above
+ }
}
#------------------------
# 'next' to avoid saving last_ values for blanks and commas
next;
}
+ else {
+ ## ok - not a special type for ci
+ }
# Save debug info if requested
DEBUG_SET_CI && do {
$input_line_no
);
}
+ else {
+ ## ok - not at a format skipping control line
+ }
$CODE_type = 'FS';
next;
}
}
# starting a new HSC chain?
- elsif (
+ if (
$rOpts->{'hanging-side-comments'} # user is allowing
# hanging side comments
elsif ( $rOpts_space_prototype_paren == 2 ) {
$token =~ s/\(/ (/;
}
+ else {
+ ## bad n value for -spp=n
+ ## FIXME: this should be caught earlier
+ }
# one space max, and no tabs
$token =~ s/\s+/ /g;
'package';
}
}
+ else {
+ ## ok
+ }
}
}
$self->check_Q( $KK, $Kfirst, $input_line_number )
if ( $self->[_save_logfile_] );
}
+ else {
+ ## ok - no special processing for this token type
+ }
# Store this token with possible previous blank
if ( $rwhitespace_flags->[$KK] == WS_YES
$seqno_parent = $rparent_of_seqno->{$seqno_parent};
}
}
+ else {
+ ## ok - none of the above
+ }
}
# Find containers with ternaries, needed for -lp formatting.
# use the standard array unless given otherwise
$rLL = $self->[_rLL_] unless ( defined($rLL) );
my $Num = @{$rLL};
- if ( !defined($KK) ) { $KK = $Num }
- elsif ( $KK > $Num ) {
+ if ( !defined($KK) ) { $KK = $Num }
+
+ if ( $KK > $Num ) {
# This fault can be caused by a programming error in which a bad $KK is
# given. The caller should make the first call with KK_new=undef to
# use the standard array unless given otherwise
$rLL = $self->[_rLL_] unless ( defined($rLL) );
my $Num = @{$rLL};
- if ( !defined($KK) ) { $KK = $Num }
- elsif ( $KK > $Num ) {
+ if ( !defined($KK) ) { $KK = $Num }
+ if ( $KK > $Num ) {
# This fault can be caused by a programming error in which a bad $KK is
# given. The caller should make the first call with KK_new=undef to
# unknown code - no match
}
}
+ else {
+ ## ok: none of the above
+ }
}
if ($match) {
my $type = $rLL->[$KK]->[_TYPE_];
$rbreak_container->{$seqno} = 1;
}
+ else {
+ ## ok: not a special case
+ }
}
}
if ( $level < $last_level ) { $in_chain{$last_level} = undef }
elsif ( $level > $last_level ) { $in_chain{$level} = undef }
+ else {
+ ## ok - level unchanged
+ }
# We are only looking at code blocks
my $token = $rtoken_vars->[_TOKEN_];
else { $in_chain{$level} = undef }
}
}
+ else {
+ ## ok - not a code block curly brace
+ }
}
return;
} ## end sub weld_cuddled_blocks
elsif ( $flag eq 'F' ) { $match = !$is_f }
elsif ( $flag eq 'w' ) { $match = $is_w }
elsif ( $flag eq 'W' ) { $match = !$is_w }
+ else {
+ ## no match
+ }
return $match;
} ## end sub match_paren_control_flag
}
}
}
+ else {
+ ## ok
+ }
}
# STEP 3: Now look ahead for a ternary and, if found, use it.
}
push @whitespace_level_stack, $level;
}
+ else {
+ ## ok - not a level change
+ }
$level = $whitespace_level_stack[-1];
$radjusted_levels->[$KK] = $level;
}
next;
}
+ else {
+ ## ok - keep going
+ }
# We are looking for opening container tokens with ci
my $K_opening = $K_opening_container->{$seqno};
elsif ( $level > $level_start_multiline_qw ) {
$len += $rOpts_indent_columns;
}
+ else {
+ ## ok - none of the above
+ }
if ( $len > $max_prong_len ) { $max_prong_len = $len }
$handle_len += 1
if ( $KK > 0 && $rLL->[ $KK - 1 ]->[_TYPE_] eq 'b' );
}
+ else {
+ ## ok
+ }
# Set a flag if the 'Interrupted List Rule' will be applied
# (see sub copy_old_breakpoints).
elsif ( $collapsed_len < MIN_BLOCK_LEN ) {
$collapsed_len = MIN_BLOCK_LEN;
}
+ else {
+ ## ok
+ }
}
# Store the result. Some extra space, '2', allows for
elsif ( $flag1 eq 'F' ) { $match_flag1 = !$is_f }
elsif ( $flag1 eq 'w' ) { $match_flag1 = $is_w }
elsif ( $flag1 eq 'W' ) { $match_flag1 = !$is_w }
- ## else { no match found }
+ else {
+ ## no match
+ }
}
# See if we can exclude this based on the flag1 test...
elsif ( $line_type eq 'SKIP_END' ) {
$file_writer_object->reset_consecutive_blank_lines();
}
+ else {
+ ## some other line type
+ }
# write unindented non-code line
if ( !$skip_line ) {
elsif ( $rOpts_kgb_before == DELETE ) {
$self->kgb_delete_if_blank( $ibeg - 1 );
}
+ else {
+ ## == STABLE
+ }
}
}
elsif ( $rOpts_kgb_after == DELETE ) {
$self->kgb_delete_if_blank( $iend + 1 );
}
+ else {
+ ## == STABLE
+ }
}
}
}
# Check for deviation from PATTERN 2, single statement:
elsif ( $level != $level_beg ) { $self->kgb_end_group(1) }
+ else {
+ ## no deviation
+ }
}
# Do not look for keywords in lists ( keyword 'my' can occur in
$is_closing_BLOCK = 1;
$nobreak_BEFORE_BLOCK = $no_internal_newlines;
}
+ else {
+ ## error - block should be enclosed by curly brace
+ DEVEL_MODE && Fault(<<EOM);
+block type '$block_type' has unexpected container type '$type'
+EOM
+ }
}
}
# if before last token ... do not allow breaks which would
# promote a side comment to a block comment
- elsif ($Ktoken_vars == $K_last - 1
+ if ( $Ktoken_vars == $K_last - 1
|| $Ktoken_vars == $K_last - 2
&& $rLL->[ $K_last - 1 ]->[_TYPE_] eq 'b' )
{
&& $Kc - $Ktoken_vars <= 2 );
$rbrace_follower = undef if ($keep_going);
}
+ else {
+ ## not an exception
+ }
}
else {
$rbrace_follower = \%is_anon_sub_brace_follower;
# essential but helps keep newer and older formatting the same.
$self->[_ris_short_broken_eval_block_]->{$type_sequence_j} = 1;
}
+ else {
+ ## ok
+ }
}
return;
} ## end sub starting_one_line_block
# breaks are forced before 'if' and 'unless'
elsif ( $is_if_unless{$token} && $type eq 'k' ) { $i-- }
+ else {
+ ## ok
+ }
if ( $i >= 0 && $i <= $max_index_to_go ) {
my $i_nonblank = ( $types_to_go[$i] ne 'b' ) ? $i : $i - 1;
push @colon_list, $type;
}
}
- elsif ( $is_closing_sequence_token{$token} ) {
+ else { ## $is_closing_sequence_token{$token}
if ( $i > 0 && $self->[_rbreak_container_]->{$seqno} ) {
$self->set_forced_breakpoint( $i - 1 );
if ( $type eq ':' ) {
push @colon_list, $type;
}
- } ## end elsif ( $is_closing_sequence_token...)
+ }
} ## end if ($seqno)
elsif ( $type eq 'f' ) {
push @i_for_semicolon, $i;
}
+ else {
+ ## not a special type
+ }
} ## end for ( my $i = 0 ; $i <=...)
# quit if we see anything besides words, function, blanks
# at this level
elsif ( $types_to_go[$i] !~ /^[\(\)Gwib]$/ ) { last }
+ else {
+ ## keep going
+ }
}
}
$blank_count = 1;
}
}
+ else {
+ ## no blank
+ }
}
# blank lines before subs except declarations and one-liners
!$self->[_ris_short_broken_eval_block_]->{$pseqno}
);
}
+ else {
+ DEVEL_MODE && Fault(<<EOM);
+Found special identifier '$special_identifier', but expecting 'sub' or 'package'
+EOM
+ }
}
}
}
}
}
+ else {
+ ## ok
+ }
if ($blank_count) {
}
}
+ else {
+ ## ok - single token
+ }
my $rbond_strength_bias = [];
if (
elsif ( $is_opening_type{ $types_to_go[$max_index_to_go] } ) {
$nesting_depth_to_go[ $max_index_to_go + 1 ] += 1;
}
+ else {
+ ## must be ? or :
+ }
return;
} ## end sub pad_array_to_go
elsif ( $is_assignment{$type} ) {
##TBD
- } ## end assignment
+ }
+ else {
+ ## ok - not a special type
+ }
+ ## end assignment
}
# ok to combine lines
)
);
}
+ else {
+ ## ok - not a special type
+ }
return ( 1, $skip_Section_3 );
} ## end sub recombine_section_2
);
$forced_breakpoint_to_go[$iend_1] = 0;
}
+ else {
+ ## ok - not a special type
+ }
return ( 1, $bs_tweak );
} ## end sub recombine_section_3
my $typer = $types_to_go[$ir];
return if ( $typel eq '?' );
return if ( $typer eq '?' );
- if ( $typel eq ':' ) { $i_first_colon = $il; last; }
- elsif ( $typer eq ':' ) { $i_first_colon = $ir; last; }
+ if ( $typel eq ':' ) { $i_first_colon = $il; last; }
+ if ( $typer eq ':' ) { $i_first_colon = $ir; last; }
}
# For long ternary chains,
if ( $ii >= 0 && $ii <= $max_index_to_go ) {
$rbond_strength_to_go->[$ii] += $bias;
}
- elsif (DEVEL_MODE) {
- my $KK = $K_to_go[0];
- my $lno = $self->[_rLL_]->[$KK]->[_LINE_INDEX_];
- Fault(
+ else {
+ if (DEVEL_MODE) {
+ my $KK = $K_to_go[0];
+ my $lno = $self->[_rLL_]->[$KK]->[_LINE_INDEX_];
+ Fault(
"Bad bond strength bias near line $lno: i=$ii must be between 0 and $max_index_to_go\n"
- );
+ );
+ }
}
}
}
elsif ( $types_to_go[$i_lowest] eq '?' ) {
$self->set_closing_breakpoint($i_lowest);
}
+ else {
+ ## ok
+ }
#--------------------------------------------------------
# ?/: rule 3 : if we break at a ':' then we save
elsif ( $types_to_go[$i_lowest] eq ':' ) {
push @i_colon_breaks, $i_lowest;
}
+ else {
+ ## ok
+ }
# here we should set breaks for all '?'/':' pairs which are
# separated by this line
$bp_count = $forced_breakpoint_count - $fbc;
$do_not_break_apart = 0 if $must_break_open;
}
+ else {
+ ## no real commas, nothing to do
+ }
}
return ( $bp_count, $do_not_break_apart );
} ## end sub set_comma_breakpoints
{
$saw_good_breakpoint = 1;
}
+ else {
+ ## not a good break
+ }
}
}
elsif ( $token eq 'if' || $token eq 'unless' ) {
$self->set_forced_breakpoint($i);
}
}
+ else {
+ ## not one of: 'and' 'or' 'if' 'unless'
+ }
}
elsif ( $is_assignment{$type} ) {
$i_equals[$depth] = $i;
}
+ else {
+ ## not a good breakpoint type
+ }
#-----------------------------------------
# Loop Section B: Handle a sequenced token
$next_nonblank_type eq ',' || $next_nonblank_type eq '=>';
}
+ else {
+ ## not a depth change
+ }
#----------------------------------
# Loop Section E: Handle this token
$current_depth = $depth;
# most token types can skip the rest of this loop
- next unless ( $quick_filter{$type} );
+ next if ( !$quick_filter{$type} );
+
+ # Turn off comma alignment if we are sure that this is not a list
+ # environment. To be safe, we will do this if we see certain
+ # non-list tokens, such as ';', '=', and also the environment is
+ # not a list.
+ ## $type =~ /^[\;\<\>\~f]$/ || $is_assignment{$type}
+ if ( $is_non_list_type{$type} ) {
+ if ( !$self->is_in_list_by_i($i) ) {
+ $dont_align[$depth] = 1;
+ $want_comma_break[$depth] = 0;
+ $index_before_arrow[$depth] = -1;
+
+ # no special comma breaks in C-style 'for' terms (c154)
+ if ( $type eq 'f' ) { $last_comma_index[$depth] = undef }
+ }
+ }
+
+ # handle any commas
+ elsif ( $type eq ',' ) {
+ $self->study_comma($comma_follows_last_closing_token);
+ }
# handle comma-arrow
- if ( $type eq '=>' ) {
+ elsif ( $type eq '=>' ) {
next if ( $last_nonblank_type eq '=>' );
next if $rOpts_break_at_old_comma_breakpoints;
next
$last_dot_index[$depth] = $i;
}
- # Turn off comma alignment if we are sure that this is not a list
- # environment. To be safe, we will do this if we see certain
- # non-list tokens, such as ';', '=', and also the environment is
- # not a list.
- ## $type =~ /^[\;\<\>\~f]$/ || $is_assignment{$type}
- elsif ( $is_non_list_type{$type}
- && !$self->is_in_list_by_i($i) )
- {
- $dont_align[$depth] = 1;
- $want_comma_break[$depth] = 0;
- $index_before_arrow[$depth] = -1;
+ else {
- # no special comma breaks in C-style 'for' terms (c154)
- if ( $type eq 'f' ) { $last_comma_index[$depth] = undef }
+ # error : no code to handle a type in %quick_filter
+ DEVEL_MODE && Fault(<<EOM);
+Missing code to handle token type '$type' which is in the quick_filter
+EOM
}
- # now just handle any commas
- next if ( $type ne ',' );
- $self->study_comma($comma_follows_last_closing_token);
-
} ## end while ( ++$i <= $max_index_to_go)
#-------------------------------------------
{
$saw_good_breakpoint = 1;
}
+ else {
+ ## not a good breakpoint
+ }
return $saw_good_breakpoint;
} ## end sub break_lists
elsif ( $is_assignment{$next_nonblank_type} ) {
$i_old_assignment_break = $i_next_nonblank;
}
+ else {
+ ## not old assignment break
+ }
RETURN:
return ( $i_want_previous_break, $i_old_assignment_break );
{
$self->set_forced_breakpoint($i_prev);
}
+ else {
+ ## not a breakpoint
+ }
}
}
# they are complex
set_fake_breakpoint();
}
+ else {
+ ## do not break open
+ }
return;
} ## end sub break_lists_decreasing_depth
}
if ( $types_to_go[$i_opening_minus] eq 'b' ) { $i_opening_minus++ }
}
+ else {
+ ## previous token not special
+ }
DEBUG_FIND_START && print <<EOM;
FIND_START: i=$i_opening_paren tok=$tokens_to_go[$i_opening_paren] => im=$i_opening_minus tok=$tokens_to_go[$i_opening_minus]
# which can be greater if there are large terms and
# little space, but usually this will work well enough.
if ( !$must_break_open ) {
-
- if ( $break_count <= 1 ) {
- ${$rdo_not_break_apart} = 1;
- }
- elsif ( $is_lp_formatting && !$need_lp_break_open ) {
+ if ( $break_count <= 1
+ || ( $is_lp_formatting && !$need_lp_break_open ) )
+ {
${$rdo_not_break_apart} = 1;
}
}
++$break_count if ($use_separate_first_term);
if ( !$must_break_open_container ) {
- if ( $break_count <= 1 ) {
- ${$rdo_not_break_apart} = 1;
- }
- elsif ( $is_lp_formatting && !$need_lp_break_open ) {
+ if ( $break_count <= 1
+ || ( $is_lp_formatting && !$need_lp_break_open ) )
+ {
${$rdo_not_break_apart} = 1;
}
}
${$rdo_not_break_apart} = 1;
}
}
+ else {
+ ## ok
+ }
}
}
{
$number_of_fields_best = $number_of_fields_max;
}
+ else {
+ ## ok
+ }
# If we are crowded and the -lp option is being used, try
# to undo some indentation
elsif ( $types_to_go[$ib] =~ /^[w\-]$/ ) {
$quote_count++;
}
+ else {
+ ## ok
+ }
if ( $ib eq $ie ) {
if ( $is_quote && $tokens_to_go[$ib] =~ /\s/ ) {
{
pop @i_ragged_break_list;
}
+ else {
+ ## ok
+ }
}
my $identifier_count = $i_max + 1 - $quote_count;
elsif ( $is_assignment{$type} ) {
$last_lp_equals{$total_depth} = $ii;
}
+ else {
+ ## not a special type
+ }
# this token might start a new line if ..
if (
if ( $types_to_go[$i_test] eq 'b' );
}
elsif ( $types_to_go[ $i_test + 1 ] eq 'b' ) { $i_test++ }
+ else {
+ ## ok
+ }
my $test_position = total_line_length( $i_test, $ii );
my $mll = $maximum_line_length_at_level[ $levels_to_go[$i_test] ];
$rvao_args->{break_alignment_before} = 1;
}
}
+ else {
+ ## ok - do not need to break vertical alignment here
+ }
# ----------------------------------
# define 'rvertical_tightness_flags'
# This experiment didn't work well: reason not determined
# if ($token ne $type) {$alignment_type .= $type}
}
+ else {
+ ## not a special type
+ }
# NOTE: This is deactivated because it causes the previous
# if/elsif alignment to fail
# We want to line up ',' and interior ';' tokens, with the added
# space AFTER these tokens. (Note: interior ';' is included
# because it may occur in short blocks).
- elsif (
+ else {
+ if (
- # previous token IS one of these:
- (
- $vert_last_nonblank_type eq ','
- || $vert_last_nonblank_type eq ';'
- )
+ # previous token IS one of these:
+ (
+ $vert_last_nonblank_type eq ','
+ || $vert_last_nonblank_type eq ';'
+ )
- # and it follows a blank
- && $types_to_go[ $i - 1 ] eq 'b'
+ # and it follows a blank
+ && $types_to_go[ $i - 1 ] eq 'b'
- # and it's NOT one of these
- && !$is_closing_token{$type}
+ # and it's NOT one of these
+ && !$is_closing_token{$type}
- # then go ahead and align
- )
+ # then go ahead and align
+ )
- {
- $alignment_type = $vert_last_nonblank_type;
+ {
+ $alignment_type = $vert_last_nonblank_type;
+ }
}
#-----------------------
}
# Strange line packing, not fatal but should not happen
- elsif (DEVEL_MODE) {
- my $max_line = @{$ri_first} - 1;
- my $ibeg = $ri_first->[0];
- my $iend = $ri_last->[0];
- my $tok_b = $tokens_to_go[$ibeg];
- my $tok_e = $tokens_to_go[$iend];
- my $type_b = $types_to_go[$ibeg];
- my $type_e = $types_to_go[$iend];
- Fault(
+ else {
+
+ if (DEVEL_MODE) {
+ my $max_line = @{$ri_first} - 1;
+ my $ibeg = $ri_first->[0];
+ my $iend = $ri_last->[0];
+ my $tok_b = $tokens_to_go[$ibeg];
+ my $tok_e = $tokens_to_go[$iend];
+ my $type_b = $types_to_go[$ibeg];
+ my $type_e = $types_to_go[$iend];
+ Fault(
"Strange..max_index=0 but nlines=$max_line ibeg=$ibeg tok=$tok_b type=$type_b iend=$iend tok=$tok_e type=$type_e; please check\n"
- );
+ );
+ }
}
}
# chain ends with previous line
$line_2 = $line - 1;
}
- elsif ( $lev > $lev_last ) {
+ else { ## ( $lev > $lev_last )
# kill chain
$line_1 = undef;
} ## end if ( $i_mate > $i && $i_mate...)
} ## end if ( $is_opening_token...)
- elsif ( $is_closing_type{$token} ) {
+ elsif ( $is_closing_token{$token} ) {
$i_depth_prev = $i;
$depth_prev = $depth;
$depth-- if $depth > 0;
}
+ else {
+ ## must be ternary
+ }
} ## end if ( $type_sequence_to_go...)
#------------------------------------------------------------
elsif ( defined($count_max) && $count >= $count_max ) {
last;
}
+ else {
+ ## continue
+ }
if ( defined( $name_map{$token} ) ) {
$token = $name_map{$token};
$adjust_indentation = 3;
}
}
+ else {
+ ## ok
+ }
#---------------------------------------------------------
# Section 2: set indentation according to flag set above
$indentation = $reduced_spaces_to_go[$i_terminal];
$lev = $levels_to_go[$i_terminal];
}
+ else {
+ ## ok - maybe default_adjust_indentation > 1 ?
+ }
}
}
}
if ( $Kterm == $K_beg ) { $adjust_indentation = 1 }
}
+ else {
+ ## ok
+ }
}
my $ris_bli_container = $self->[_ris_bli_container_];
elsif ( $cti == 3 ) {
$adjust_indentation = 3;
}
+ else {
+ ## cti == 0
+ }
}
# handle option to indent blocks
$rindentation_list );
if ($is_leading) { $adjust_indentation = 2; }
}
+ else {
+ # not a closing type
+ }
return (
unless ( $block_type_to_go[$ibeg_next] )
; # shouldn't happen; just checking
}
+ else {
+ ## not stackable
+ }
if ($stackable) {
$vt_valid_flag = 1;
}
+ else {
+ ## none of the above
+ }
# get the sequence numbers of the ends of this line
$vt_seqno_beg = $type_sequence_to_go[$ibeg];
$leading_block_text_length_exceeded = 1;
$leading_block_text .= '...';
}
+ else {
+ ## ok
+ }
}
return;
} ## end sub accumulate_block_text
}
}
}
+ else {
+ ## should not get here
+ DEVEL_MODE
+ && Fault("token=$token should be '{' or '}' for block\n");
+ }
}
if ( $type eq 'k'
elsif ( $block_type_to_go[$i_terminal] eq 'elsif' ) {
if ( $old_csc =~ /\[\s*if/ ) { $old_csc = $new_csc }
}
+ else {
+ ## ok: neither else or elsif
+ }
# if old comment is contained in new comment,
# only compare the common part.
$ri_last->[-1] = $iend;
}
}
+ else {
+ ## above threshold, cannot delete
+ }
}
# switch to the new csc (unless we deleted it!)