]> git.donarmstrong.com Git - perltidy.git/commitdiff
Correct brace types mismarked by tokenizer
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 2 May 2021 04:14:07 +0000 (21:14 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 2 May 2021 04:14:07 +0000 (21:14 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 3410b651dcd57ecec99414e1f1c75cea447a5120..6bd766f92a2a2c597bd3e894c8cf2bedda5a3cfb 100644 (file)
@@ -4943,6 +4943,19 @@ sub dump_verbatim {
     return;
 }
 
+my %wU;
+my %wiq;
+
+BEGIN {
+
+    # added 'U' to fix cases b1125 b1126 b1127
+    my @q = qw(w U);
+    @{wU}{@q} = (1) x scalar(@q);
+
+    @q = qw(w i q Q G C Z);
+    @{wiq}{@q} = (1) x scalar(@q);
+}
+
 sub respace_tokens {
 
     my $self = shift;
@@ -6045,7 +6058,9 @@ sub respace_tokens {
             $Knn2 = $self->K_next_nonblank( $Knn1, $rLL_new ) if defined($Knn1);
             $type_nn1 = $rLL_new->[$Knn1]->[_TYPE_] if ( defined($Knn1) );
             $type_nn2 = $rLL_new->[$Knn2]->[_TYPE_] if ( defined($Knn2) );
-            if ( $type_nn1 eq 'w' && $type_nn2 =~ /^[wiqQGCZ]$/ ) {
+
+            #   if ( $type_nn1 =~ /^[wU]$/ && $type_nn2 =~ /^[wiqQGCZ]$/ ) {
+            if ( $wU{$type_nn1} && $wiq{$type_nn2} ) {
                 $is_list = 0;
             }
 
index 377f1ba751e441eb2c1a47dbc1b0ffbce2667319..b4ce52a1de0ec29aa44025bac4f7c58ea51dfd41 100644 (file)
@@ -2,6 +2,16 @@
 
 =over 4
 
+=item B<Correct brace types mismarked by tokenizer>
+
+This is a generalization of commit 7d23bf4 to fix some additional cases
+found in random testing in which the type of a curly brace could not be
+determined in the tokenizer and was not being corrected by the formatter.
+
+This fixes cases b1125 b1126 b1127.
+
+2 May 2021.
+
 =item B<Avoid instability of combination -bbx=2 -lp and -xci>
 
 Random testing produced several cases in which the flags -bbx=2 -lp and -xci