$rOpts->{'line-up-parentheses-inclusion-list'}, 'lpil' );
}
else {
- ## ok - neither -lpxl nor -lpil
+ # neither -lpxl nor -lpil specified
}
return;
}
EOM
}
else {
- ## ok - no error seen
+ # no error seen
}
$rkeep_break_hash->{$key} = $flag;
if ( $bond_str < STRONG ) { $bond_str = STRONG }
}
else {
- ## ok - not special
+ # no applicable hardwired change
}
#---------------------------------------------------------------
}
}
else {
- ## ok - not special
+ # no hardwired rule applies
}
# Breaking before a ? before a quote can cause trouble if
&& $next_nonblank_type ne '//' );
}
else {
- ## ok - not special
+ # no special NO_BREAK rule applies
}
$bond_str_2 = $bond_str if (DEBUG_BOND);
$strength -= 1;
}
else {
- ## ok - not welded left or right
+ # not welded left or right
}
}
}
}
else {
- ## ok - no -csc issues
+ # no -csc flags
}
return;
$self->[_ris_sub_block_]->{$seqno} = 1;
}
else {
- ## ok - not a sub
+ # not a sub type
}
return;
} ## end sub store_block_type
$rparent->{_container_type} eq 'Logical';
}
else {
- ## ok - none of the above
+ # does not look like a logical paren
}
}
}
}
- #---------------------------------
- # Section 8. Hanging side comments
- #---------------------------------
- # Treat hanging side comments like blanks
- elsif ( $type eq 'q' && $token eq EMPTY_STRING ) {
- $ci_next = $ci_this;
-
- $rtoken_K->[_CI_LEVEL_] = $ci_this;
-
- # 'next' to avoid saving last_ values for blanks and commas
- next;
- }
else {
- ## ok - not a special type for ci
+ # not a special ci type
}
# Save debug info if requested
);
}
else {
- ## ok - not at a format skipping control line
+ # not at a format skipping control line
}
$CODE_type = 'FS';
next;
if ( $self->[_save_logfile_] );
}
else {
- ## ok - no special processing for this token type
+ # no special processing for this token type
}
# Store this token with possible previous blank
}
}
else {
- ## ok - none of the above
+ # nothing special to do for this container token
}
}
}
}
else {
- ## ok: none of the above
+ # no match
}
}
if ($match) {
$rbreak_container->{$seqno} = 1;
}
else {
- ## ok: not a special case
+ # not a special case
}
}
}
if ( $level < $last_level ) { $in_chain{$last_level} = undef }
elsif ( $level > $last_level ) { $in_chain{$level} = undef }
else {
- ## ok - ($level == $last_level)
+ # ok - level unchanged
}
# We are only looking at code blocks
}
}
else {
- ## ok - not a curly brace
+ # not a curly brace
}
}
return;
}
}
else {
- ## ok
+ # do not need to backup
}
}
$collapsed_len = MIN_BLOCK_LEN;
}
else {
- ## ok
+ # none of these rules applies
}
}
$self->[_ris_short_broken_eval_block_]->{$type_sequence_j} = 1;
}
else {
- ## ok
+ # ok
}
}
return;
# breaks are forced before 'if' and 'unless'
elsif ( $is_if_unless{$token} && $type eq 'k' ) { $i-- }
else {
- ## ok
+ # do not break before
}
if ( $i >= 0 && $i <= $max_index_to_go ) {
}
}
else {
- ## ok
+ # no blank line needed
}
if ($blank_count) {
}
}
else {
- ## ok - single token
+ # single balanced token
}
my $rbond_strength_bias = [];
##TBD
}
else {
- ## ok - not a special type
+ # not a special type
}
## end assignment
}
return if ( !$combine_ok );
}
else {
- ## ok - not a special type
+ # 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
+ # not a special type
}
return ( 1, $bs_tweak );
} ## end sub recombine_section_3
$self->set_closing_breakpoint($i_lowest);
}
else {
- ## ok
+ # not at a '?'
}
#--------------------------------------------------------
push @i_colon_breaks, $i_lowest;
}
else {
- ## ok
+ # not at a ':'
}
# here we should set breaks for all '?'/':' pairs which are
}
}
else {
- ## ok
+ # break
}
}
}
$number_of_fields_best = $number_of_fields_max;
}
else {
- ## ok
+ # no change
}
# If we are crowded and the -lp option is being used, try
$quote_count++;
}
else {
- ## ok
+ # not a quote
}
if ( $ib eq $ie ) {
pop @i_ragged_break_list;
}
else {
- ## ok
+ # ok as is
}
}
}
elsif ( $types_to_go[ $i_test + 1 ] eq 'b' ) { $i_test++ }
else {
- ## ok
+ # ok - no change needed
}
my $test_position = total_line_length( $i_test, $ii );
}
}
else {
- ## ok - do not need to break vertical alignment here
+ # ok - do not need to break vertical alignment here
}
# ----------------------------------
sub make_HSC_vertical_alignments {
# This is the alignment for a hanging side comment
- # Originally, a hanging side comment line was constructed as three tokens:
- # type 'q' with zero length,
- # type 'b' with length 1
- # type '#' with the text of the comment
- # In this way, the comment became a true side comment through all of the
- # tokenization operations. However, this caused a problem (c269) with subs
- # K_next_* and K_previous_*, which would stop at the 'q' token. Rather
- # than change those to skip an empty 'q', the hanging side comment was
- # left as a block comment but the line was marked as 'HSC'. Only when
- # we make the vertical alignments, right here, do we need to construct
- # the artificial 'q', 'b', '#' sequence for the vertical aligner.
my $rline_alignments;
+ #--------------------------------------
+ # Case 1: no alignments if -naws is set
+ #--------------------------------------
+ if ( !$rOpts_add_whitespace ) {
+
+ # Nothing to do if we are not allowed to add whitespace
+ my $pad_spaces = $rOpts->{'minimum-space-to-comment'};
+ $rline_alignments = [
+ [
+ [], [ SPACE . $tokens_to_go[0] ],
+ ['#'],
+ [ 1 + $summed_lengths_to_go[1] - $summed_lengths_to_go[0] ],
+ ]
+ ];
+ }
+
+ #-----------------------
+ # Case 2: -nvsc flag set
+ #-----------------------
# - For the specific combination -vc -nvsc, we put all side comments
# at fixed locations. Note that we will lose hanging side comment
# alignments. Otherwise, hsc's can move to strange locations.
# because the vertical aligner will check for -nvsc and be able
# to reduce the final padding to the side comments for long lines.
# and keep hanging side comments aligned.
- if ( !$rOpts_valign_side_comments && $rOpts_valign_code ) {
+ elsif ( !$rOpts_valign_side_comments && $rOpts_valign_code ) {
my $pad_spaces = $rOpts->{'minimum-space-to-comment'};
$rline_alignments = [
[
[],
[ SPACE x $pad_spaces . $tokens_to_go[0] ],
['q'],
- [ 2 + $summed_lengths_to_go[1] - $summed_lengths_to_go[0] ],
+ [
+ $pad_spaces +
+ $summed_lengths_to_go[1] -
+ $summed_lengths_to_go[0]
+ ],
]
];
}
+
+ #--------------------------------------
+ # Case 3: Normal case of no constraints
+ #--------------------------------------
+ # Originally, a hanging side comment line was constructed as three tokens:
+ # type 'q' with zero length,
+ # type 'b' with length 1
+ # type '#' with the text of the comment
+ # In this way, the comment became a true side comment through all of the
+ # tokenization operations. However, this caused a problem (c269) with subs
+ # K_next_* and K_previous_*, which would stop at the 'q' token. Rather
+ # than change those to skip an empty 'q', the hanging side comment was
+ # left as a block comment but the line was marked as 'HSC'. Only when
+ # we make the vertical alignments, right here, do we need to construct
+ # the artificial 'q', 'b', '#' sequence for the vertical aligner.
else {
$rline_alignments = [
[
]
];
}
+
return $rline_alignments;
}
}
}
else {
- ## ok
+ # leading token not special
}
#---------------------------------------------------------
$lev = $levels_to_go[$i_terminal];
}
else {
- ## ok - maybe default_adjust_indentation > 1 ?
+ # shouldn't happen - default_adjust_indentation is 0 or 1
}
}
}
if ( $Kterm == $K_beg ) { $adjust_indentation = 1 }
}
else {
- ## ok
+ # no change in ci needed
}
}
$rOpts_closing_side_comment_maximum_text
)
- # UNLESS: we are adding a closing paren before the brace we seek.
- # This is an attempt to avoid situations where the ... to be
- # added are longer than the omitted right paren, as in:
+ # UNLESS: we are adding a closing paren before the brace we
+ # seek. This is an attempt to avoid situations where the ...
+ # to be added are longer than the omitted right paren, as in:
- # foreach my $item (@a_rather_long_variable_name_here) {
- # &whatever;
- # } ## end foreach my $item (@a_rather_long_variable_name_here...
+ #foreach my $item (@a_rather_long_variable_name_here) {
+ # &whatever;
+ #} ## end foreach my $item (@a_rather_long_variable_name_here...
|| (
$tokens_to_go[$i] eq ')'
$leading_block_text .= '...';
}
else {
- ## ok
+ # not enough space to add text
}
}
return;
if ( $old_csc =~ /\[\s*if/ ) { $old_csc = $new_csc }
}
else {
- ## ok: neither else or elsif
+ # neither else or elsif
}
# if old comment is contained in new comment,
);
}
else {
- ## ok - not a code-skipping control line
+ # not a code-skipping control line
}
return $line_of_tokens;
}
}
}
else {
- ## ok
+ # not a special control line
}
# check for a hash-bang line if we haven't seen one
return $line_of_tokens;
}
else {
- ## ok: not in __END__ or __DATA__
+ # not in __END__ or __DATA__
}
# now, finally, we know that this line is type 'CODE'
if ( $self->[_in_quote_]
and ( $self->[_line_start_quote_] < 0 ) )
{
-
- #if ( ( my $quote_target = get_quote_target() ) !~ /^\s*$/ ) {
if ( ( my $quote_target = $self->[_quote_target_] ) !~ /^\s*$/ ) {
$self->[_line_start_quote_] = $input_line_number;
$self->log_numbered_msg(
$self->log_numbered_msg("End of multi-line quote or pattern\n");
}
else {
- ## ok
+ # not at the edge of a quote
}
# we are returning a line of CODE
$self->warning("Unexpected leading ',' after a '('\n");
}
else {
- ## ok: no complaints needed
+ # no complaints about the comma
}
# patch for operator_expected: note if we are in the list (use.t)
$want_paren = EMPTY_STRING;
}
else {
- ## ok: not special
+ # not special
}
# now identify which of the three possible types of
"Unconventional here-target: '$here_doc_target'\n");
}
else {
- ## ok: nothing to complain about
+ # nothing to complain about
}
}
elsif ( $expecting == TERM ) {
"Unconventional here-target: '$here_doc_target'\n");
}
else {
- ## ok: nothing to complain about
+ # nothing to complain about
}
# Note that we put a leading space on the here quote
$self->[_in_error_] = 1;
}
else {
- ## ok - valid token type other than ; and t
+ # valid token type other than ; and t
}
#----------------------------------------------------
"Space in identifier, following $identifier\n";
}
else {
- ## ok: silently accept space after '$' and '@' sigils
+ # silently accept space after '$' and '@' sigils
}
}
}