sub parent_sub_seqno_by_K {
my ( $self, $KK ) = @_;
+ # NOTE: not currently called but keep for possible future development
+
# Find sequence number of the sub or asub which contains a given token
# Given:
# $K = index K of a token
# Returns:
# $seqno of the sub (or asub), or
# nothing if no sub found
+
return unless defined($KK);
my $seqno_sub;
my $rLL = $self->[_rLL_];
my $K_opening_block = $self->[_K_opening_container_]->{$seqno_block};
my $rlines = $self->[_rlines_];
- my $Klimit = @{$rLL} - 1;
my $ix_HERE_END = -1;
# Optimization: find the previous type 'S' token with the sub name .. this
# Skip external method calls
next if ( $rcall_item->{is_external_call} );
- my $arg_count = $rcall_item->{arg_count};
- my $package = $rcall_item->{package};
- my $name = $rcall_item->{name};
- my $line_number = $rcall_item->{line_number};
- my $call_type = $rcall_item->{call_type};
- my $caller_name = $rcall_item->{caller_name};
- my $key = $package . '::' . $name;
+ my $arg_count = $rcall_item->{arg_count};
+ my $package = $rcall_item->{package};
+ my $name = $rcall_item->{name};
+ my $call_type = $rcall_item->{call_type};
+ my $key = $package . '::' . $name;
my ( $shift_count_min, $shift_count_max, $self_name );
my $seqno_sub = $rsub_seqno_by_key->{$key};
my $rdirect_calls = $item->{direct_calls};
my $num_self = defined($rself_calls) ? @{$rself_calls} : 0;
my $num_direct = defined($rdirect_calls) ? @{$rdirect_calls} : 0;
- my $num_method = defined($rmethod_calls) ? @{$rmethod_calls} : 0;
my $shift_count_min = $rsub_item->{shift_count_min};
my $shift_count_max = $rsub_item->{shift_count_max};
# - warn-mismatched-arg-types
# - warn-mismatched-arg-exclusion-list
# - warn-mismatched-arg-undercount-cutoff
+ # - warn-mismatched-arg-overcount-cutoff
my ( $rwarnings, $hint ) = $self->cross_check_call_args(1);
return unless ( $rwarnings && @{$rwarnings} );
# works well but is currently only activated when the -xci flag is set.
# The reason is to avoid unexpected changes in formatting.
if ($rOpts_extended_continuation_indentation) {
- while ( my ( $qw_seqno_x, $rKrange ) =
- each %{$rKrange_multiline_qw_by_seqno} )
- {
+ foreach my $qw_seqno_x ( keys %{$rKrange_multiline_qw_by_seqno} ) {
+ my $rKrange = $rKrange_multiline_qw_by_seqno->{$qw_seqno_x};
my ( $Kbeg, $Kend ) = @{$rKrange};
# require isolated closing token
# multiline quotes
if ( $rOpts_line_up_parentheses && !$rOpts_extended_line_up_parentheses ) {
- while ( my ( $qw_seqno_x, $rKrange ) =
- each %{$rKrange_multiline_qw_by_seqno} )
- {
+ foreach my $qw_seqno_x ( keys %{$rKrange_multiline_qw_by_seqno} ) {
+ my $rKrange = $rKrange_multiline_qw_by_seqno->{$qw_seqno_x};
my ( $Kbeg, $Kend ) = @{$rKrange};
my $parent_seqno = $self->parent_seqno_by_K($Kend);
next unless ($parent_seqno);
#------------------------------------------------------------------
# Find the best next breakpoint based on token-token bond strengths
#------------------------------------------------------------------
- my ( $i_lowest, $lowest_strength, $leading_alignment_type, $Msg ) =
+ my ( $i_lowest, $lowest_strength, $Msg ) =
$self->break_lines_inner_loop(
$i_begin,
# Returns:
# $i_lowest = index of best breakpoint
# $lowest_strength = 'bond strength' at best breakpoint
- # $leading_alignment_type = special token type after break
# $Msg = string of debug info
my $Msg = EMPTY_STRING;
# We will break at imax if no other break was found.
if ( $i_lowest < 0 ) { $i_lowest = $imax }
- return ( $i_lowest, $lowest_strength, $leading_alignment_type, $Msg );
+ return ( $i_lowest, $lowest_strength, $Msg );
} ## end sub break_lines_inner_loop
sub do_colon_breaks {
# opening container token does not end a line, and this causes the double
# jump.
- my $rLL = $self->[_rLL_];
my $max_line = @{$ri_first} - 1;
return if ( $max_line < 1 );
( $i, $type ) =
$self->find_angle_operator_termination( $input_line, $i,
$rtoken_map, $expecting, $max_token_index );
-
- ## This message is not very helpful and quite confusing if the above
- ## routine decided not to write a message with the line number.
- ## if ( $type eq '<' && $expecting == TERM ) {
- ## $self->error_if_expecting_TERM();
- ## $self->interrupt_logfile();
- ## $self->warning("Unterminated <> operator?\n");
- ## $self->resume_logfile();
- ## }
-
}
else {
}
elsif ( $tok eq 'elsif' ) {
if (
- ## !~ /^(if|elsif|unless)$/
!$is_if_elsif_unless{$last_nonblank_block_type}
# Allow isolated blocks of any kind during editing
# patched for SWITCH/CASE
if (
- ## !~ /^(if|elsif|unless|case|when)$/
!$is_if_elsif_unless_case_when{$last_nonblank_block_type}
# patch to avoid an unwanted error message for
# the case of a parenless 'case' (RT 105484):
# switch ( 1 ) { case x { 2 } else { } }
- ## !~ /^(if|elsif|unless|case|when)$/
&& !$is_if_elsif_unless_case_when{$statement_type}
# Allow isolated blocks of any kind during editing (c272)
# use Module VERSION LIST
# We could avoid this exception by writing a special sub to parse 'use'
# statements and perhaps mark these numbers with a new type V (for VERSION)
- ##elsif ( $last_nonblank_type =~ /^[nv]$/ ) {
if ( $is_n_v{$last_nonblank_type} ) {
if ( $statement_type eq 'use' ) {
return UNKNOWN;
# it is a comma which is not a pattern delimiter except for qw
(
$pre_types[$j] eq ','
- ## !~ /^(s|m|y|tr|qr|q|qq|qx)$/
&& !$is_q_qq_qx_qr_s_y_tr_m{ $pre_tokens[$jbeg] }
)
# In something like '$${' we have type '$$' (and only
# part of an identifier)
&& !( $identifier =~ /\$$/ && $tok eq '{' )
-
- ## && ( $identifier !~ /^(sub |package )$/ )
&& $identifier ne 'sub '
&& $identifier ne 'package '
)
while ( $i < $max_token_index ) {
$tok = $rtokens->[ ++$i ];
- ##if ( $tok !~ /^\s*$/ ) {
if ( $rtoken_type->[$i] ne 'b' ) {
if ( ( $tok eq '#' ) && ($allow_quote_comments) ) {