]> git.donarmstrong.com Git - perltidy.git/commitdiff
convert regex to hash
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 12 Nov 2020 16:04:18 +0000 (08:04 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 12 Nov 2020 16:04:18 +0000 (08:04 -0800)
lib/Perl/Tidy/Formatter.pm

index 0ef666db1b22f6ac3eb44dc9656a9ab08b0b648e..e265cadffedfd33b48794159d2c9287f3560b996 100644 (file)
@@ -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 );