]> git.donarmstrong.com Git - perltidy.git/commitdiff
updated tokenizer to prevent a blinking state
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 16 Jan 2021 17:59:27 +0000 (09:59 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 16 Jan 2021 17:59:27 +0000 (09:59 -0800)
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index 63ca4710760e452fe4a4772dc5c8c473ae2c21cc..d45cc405ae583d50c6f109b10eb20122c7147eb1 100644 (file)
@@ -6165,8 +6165,11 @@ sub scan_bare_identifier_do {
               )
             {
 
-                # may not be indirect object unless followed by a space
-                if ( $input_line =~ m/\G\s+/gc ) {
+                # may not be indirect object unless followed by a space;
+                # updated 2021-01-16 to consider newline to be a space.
+                if ( pos($input_line) == length($input_line)
+                    || $input_line =~ m/\G\s+/gc )
+                {
                     $type = 'Y';
 
                     # Abandon Hope ...
index 5e281d49448d53bff123b317e7b96228c085c647..71bccffd5236626856e574cc3579100fe920e232 100644 (file)
@@ -2,10 +2,39 @@
 
 =over 4
 
+=item B<Fixed blinker related to line break at indirect object>
+
+In random testing a blinker was reduced to the following snippet
+
+    {
+             print FILE
+              GD::Barcode
+              ->new();
+    }
+
+which switched to the following state on each iteration
+
+    {
+             print FILE GD::Barcode
+              ->new();
+    }
+
+with the following parameters
+
+    --maximum-line-length=20
+    --indent-columns=9
+    --continuation-indentation=1
+
+The problem was that the token 'FILE' was either parsed as type 'Y'
+or 'Z' depending on the existance of a subsequent space.  These have
+different line break rules, causing a blinker. The problem was
+fixed by modifying the tokenizer to consider a newline to be a space.
+Updated 16 Jan 2021.
+
 =item B<Turn off -bli if -bar is set>
 
 A conflict arises if both B<-bli> and B<-bar> are set. In this case a warning message
-is given and B<-bli> is turned off.
+is given and B<-bli> is turned off.  Updated 15 Jan 2021.
 
 =item B<Fixed blinker related to large -ci, short line length and -bbsbi=2 -bbsb=1>