]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix problem with side comment after pattern
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 13 Jul 2021 16:10:56 +0000 (09:10 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 13 Jul 2021 16:10:56 +0000 (09:10 -0700)
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index 7dec89972ec7417af3a758cdf33915cff25630c5..0ced2cf2e5a2ac9a692bf9e8a8617ff9d45a31bd 100644 (file)
@@ -3767,9 +3767,9 @@ EOM
                 if ( $last_nonblank_token eq '->' ) {
                     scan_bare_identifier();
 
-                    # Patch for c043, part 4; use type 'w' after a '->'
-                    # This is just a safety check on sub scan_bare_identifier, which
-                    # should get this case correct.
+                    # Patch for c043, part 4; use type 'w' after a '->'.
+                    # This is just a safety check on sub scan_bare_identifier,
+                    # which should get this case correct.
                     $type = 'w';
                     next;
                 }
@@ -7792,7 +7792,10 @@ sub is_possible_numerator {
         }
         else {
 
-            if ( $next_nonblank_token =~ /^\s*$/ ) {
+            # Added '#' to fix issue c044
+            if (   $next_nonblank_token =~ /^\s*$/
+                || $next_nonblank_token eq '#' )
+            {
                 $is_pattern = 0;
             }
             else {
index bfc33fe691df188cef96b59eacb024c921218c4d..536903be64cf8083c80b75bfcab58bae6551931b 100644 (file)
@@ -2,6 +2,26 @@
 
 =over 4
 
+=item B<Fix problem with side comment after pattern>
+
+Testing with randomly placed side comments produced an error illustrated
+with the following snippet:
+
+    testit
+    /A (*THEN) X | B (*THEN) C/x#sc#
+    ,
+    "Simple (*THEN) test"
+    ;
+
+If 'testit' is an unknown bareword then perltidy has to guess
+if the '/' is a division or can start a pattern.  In this case the side
+comment caused a bad guess.  This is case c044 and is fixed with this update.
+There are no other known issues with side comments at the present time
+but testing continues.
+
+13 Jul 2021.
+
+
 =item B<Fix problem with side comment after pointer, part 3>
 
 This update fixes some incorrect tokenization produced by a side comment