From: Steve Hancock <perltidy@users.sourceforge.net>
Date: Fri, 17 Dec 2021 13:55:49 +0000 (-0800)
Subject: fix tokenization issue b1280
X-Git-Tag: 20211029.04~3
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f17c042e738505a6481b93be0b9dfc18415a4712;p=perltidy.git

fix tokenization issue b1280
---

diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data
index b1e48b43..53295cb7 100644
--- a/dev-bin/run_convergence_tests.pl.data
+++ b/dev-bin/run_convergence_tests.pl.data
@@ -8452,6 +8452,50 @@ function(
 --maximum-line-length=30
 --variable-maximum-line-length
 
+==> b1280.in <==
+# S1
+    for my $method qw(GetBook Wishlist AddBook RemoveBook
+      PurchaseBooks) {
+        eval "sub $method";
+        *$method = sub {
+            my $self = shift->new;
+            die SOAP::Fault->faultcode('Server.RequestError')
+              ->faultstring('Could not get object')
+              unless $self;
+
+            my $smethod = "SUPER::$method";
+            my $res     = $self->$smethod(@_);
+            die SOAP::Fault->faultcode('Server.ExecError')
+              ->faultstring("Execution error: $res")
+              unless ref($res);
+
+            $res;
+        };
+      }
+# S2
+    for my $method qw(GetBook Wishlist AddBook RemoveBook
+      PurchaseBooks)
+      {
+        eval "sub $method";
+        *$method = sub {
+            my $self = shift->new;
+            die SOAP::Fault->faultcode('Server.RequestError')
+              ->faultstring('Could not get object')
+              unless $self;
+
+            my $smethod = "SUPER::$method";
+            my $res     = $self->$smethod(@_);
+            die SOAP::Fault->faultcode('Server.ExecError')
+              ->faultstring("Execution error: $res")
+              unless ref($res);
+
+            $res;
+        };
+      }
+
+==> b1280.par <==
+--brace-left-and-indent
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm
index a752ebba..9229a0a0 100644
--- a/lib/Perl/Tidy/Tokenizer.pm
+++ b/lib/Perl/Tidy/Tokenizer.pm
@@ -3500,7 +3500,11 @@ EOM
                     $routput_token_type->[$i] = $type;
 
                 }
-                $tok = $quote_character if ($quote_character);
+
+                # Removed to fix b1280.  This is not needed and was causing the
+                # starting type 'qw' to be lost, leading to mis-tokenization of
+                # a trailing block brace in a parenless for stmt 'for .. qw.. {'
+                ##$tok = $quote_character if ($quote_character);
 
                 # scan for the end of the quote or pattern
                 (
@@ -9806,4 +9810,3 @@ BEGIN {
 
     @is_keyword{@Keywords} = (1) x scalar(@Keywords);
 }
-1;