From: Steve Hancock Date: Thu, 12 Nov 2020 16:04:18 +0000 (-0800) Subject: convert regex to hash X-Git-Tag: 20201202~37 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6fa3110434618cdaef3bba1daf24820bbd31f50d;p=perltidy.git convert regex to hash --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 0ef666db..e265cadf 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -17907,6 +17907,7 @@ sub K_mate_index { my %block_type_map; my %keyword_map; my %operator_map; + my %is_w_n_C; BEGIN { @@ -17945,6 +17946,12 @@ sub K_mate_index { '*=' => '+=', '/=' => '+=', ); + + %is_w_n_C = ( + 'w' => 1, + 'n' => 1, + 'C' => 1, + ); } sub delete_needless_alignments { @@ -18314,7 +18321,8 @@ sub K_mate_index { # Mark most things before arrows as a quote to # get them to line up. Testfile: mixed.pl. - if ( ( $i < $iend - 1 ) && ( $type =~ /^[wnC]$/ ) ) { + # $type =~ /^[wnC]$/ + if ( $i < $iend - 1 && $is_w_n_C{$type} ) { my $next_type = $types_to_go[ $i + 1 ]; my $i_next_nonblank = ( ( $next_type eq 'b' ) ? $i + 2 : $i + 1 );