%is_if_unless_and_or_last_next_redo_return,
%is_if_elsif_else_unless_while_until_for_foreach,
%is_if_unless_while_until_for_foreach,
+ %is_for_foreach,
%is_last_next_redo_return,
%is_if_unless,
%is_if_elsif,
@is_if_unless_while_until_for_foreach{@q} =
(1) x scalar(@q);
+ # These can have several forms
+ @q = qw(for foreach);
+ @is_for_foreach{@q} = (1) x scalar(@q);
+
@q = qw(last next redo return);
@is_last_next_redo_return{@q} = (1) x scalar(@q);
return $rwhitespace_flags if ( $jmax < 0 );
- my %is_for_foreach = ( 'for' => 1, 'foreach' => 1 );
-
# function to return $ws for a signature paren following a sub
my $ws_signature_paren = sub {
my ($jj) = @_;
{ ## begin closure is_essential_whitespace
my %is_sort_grep_map;
- my %is_for_foreach;
my %is_digraph;
my %is_trigraph;
my %essential_whitespace_filter_l1;
@q = qw(sort grep map);
@is_sort_grep_map{@q} = (1) x scalar(@q);
- @q = qw(for foreach);
- @is_for_foreach{@q} = (1) x scalar(@q);
-
@q = qw(
.. :: << >> ** && || // -> => += -= .= %= &= |= ^= *= <>
<= >= == =~ !~ != ++ -- /= x= ~~ ~. |. &. ^.
my %is_my_state = ( 'my' => 1, 'state' => 1 );
my %is_valid_sigil = ( '$' => 1, '@' => 1, '%' => 1 );
- # These can have the form keyword ( .... ) { BLOCK }
- my %is_for_foreach = ( 'for' => 1, 'foreach' => 1 );
- my %is_blocktype_with_paren;
-
- # Note that 'elsif' is not in this list because it is handled specially
- my @q = qw(if unless while until for foreach);
- @is_blocktype_with_paren{@q} = (1) x scalar(@q);
-
# Variables defining current state:
my $current_package = 'package main';
# look for certain keywords which introduce blocks:
# such as 'for my $var (..) { ... }'
#--------------------------------------------------
- elsif ( $is_blocktype_with_paren{$token} ) {
+ elsif ( $is_if_unless_while_until_for_foreach{$token} ) {
my $seqno_brace = $seqno_brace_after_paren->($KK);
if ($seqno_brace) {
# | K_closing_paren
# $seqno_paren = seqno of this paren pair
- # FIXME: sub $seqno_brace_after_paren in sub scan_variable_usage can
- # eventually be simplified to make use of this sub. But we would need to
- # first add a check for repeated parens.
+ # NOTE: sub '$seqno_brace_after_paren' in sub 'scan_variable_usage' is
+ # similar but sufficiently different that the two subs cannot be merged.
return unless $seqno_paren;
my $K_closing_paren = $self->[_K_closing_container_]->{$seqno_paren};