fix from Larry for parsing C<{ 0x1 => 'foo'}> as an
Gurusamy Sarathy [Sat, 18 Dec 1999 01:35:50 +0000 (01:35 +0000)]
anon hash rather than a block; test case for the same

p4raw-id: //depot/perl@4697

t/comp/term.t
toke.c

index eb99680..f079eef 100755 (executable)
@@ -1,10 +1,8 @@
 #!./perl
 
-# $RCSfile: term.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:24 $
-
 # tests that aren't important enough for base.term
 
-print "1..22\n";
+print "1..23\n";
 
 $x = "\\n";
 print "#1\t:$x: eq " . ':\n:' . "\n";
@@ -68,3 +66,7 @@ if (ref($a) eq 'HASH') {print "ok 21\n";} else {print "not ok 21\n";}
 $a = "+{ \$a=>'foo'}";
 $a = eval $a;
 if (ref($a) eq 'HASH') {print "ok 22\n";} else {print "not ok 22\n";}
+
+$a = "{ 0x01 => 'foo'}->{0x01}";
+$a = eval $a;
+if ($a eq 'foo') {print "ok 23\n";} else {print "not ok 23\n";}
diff --git a/toke.c b/toke.c
index 57e263f..ff239a6 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2909,7 +2909,8 @@ Perl_yylex(pTHX)
                    if (++t < PL_bufend
                        && (!isALNUM(*t)
                            || ((*t == 'q' || *t == 'x') && ++t < PL_bufend
-                               && !isALNUM(*t)))) {
+                               && !isALNUM(*t))))
+                   {
                        char *tmps;
                        char open, close, term;
                        I32 brackets = 1;
@@ -2940,8 +2941,10 @@ Perl_yylex(pTHX)
                    }
                    t++;
                }
-               else if (isIDFIRST_lazy(s)) {
-                   for (t++; t < PL_bufend && isALNUM_lazy(t); t++) ;
+               else if (isALNUM_lazy(t)) {
+                   t += UTF8SKIP(t);
+                   while (t < PL_bufend && isALNUM_lazy(t))
+                        t += UTF8SKIP(t);
                }
                while (t < PL_bufend && isSPACE(*t))
                    t++;