]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix c208, misparse of '$1x$2'
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 30 Mar 2023 23:41:42 +0000 (16:41 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 30 Mar 2023 23:41:42 +0000 (16:41 -0700)
This was found in some obfuscated perl code.

dev-bin/run_tokenizer_tests.pl.data
lib/Perl/Tidy/Tokenizer.pm

index 408ea2c48441e9de9fc22a888262f3238656b3fa..0c6cb7b1d7b0cb495b4326db88d3236cb84bd89c 100644 (file)
@@ -159,6 +159,9 @@ my $str = $$# the process ID
  . " xxx\n";
 print "str='$str'\n";
 
+==> c208.in <==
+$1x$2
+
 ==> git82.in <==
 say
 $
index 1a3a861fd0322ac59e2770ea2f15fe8fd35b0424..0ca95c3913659a4d4437482f72c74f5d93bfa2be 100644 (file)
@@ -7893,9 +7893,11 @@ sub do_scan_package {
             }
         }
         elsif ( $tok =~ /^\w/ ) {    # alphanumeric ..
-            $saw_alpha     = 1;
-            $id_scan_state = $scan_state_COLON;    # now need ::
+            $saw_alpha = 1;
             $identifier .= $tok;
+
+            # now need :: except for special digit vars like '$1' (c208)
+            $id_scan_state = $tok =~ /^\d/ ? EMPTY_STRING : $scan_state_COLON;
         }
         elsif ( $tok eq '::' ) {
             $id_scan_state = $scan_state_ALPHA;