From: Gurusamy Sarathy Date: Sat, 18 Dec 1999 01:35:50 +0000 (+0000) Subject: fix from Larry for parsing C<{ 0x1 => 'foo'}> as an X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0505442f3c585b66999f71b9bb23ab4d01c6531a;p=p5sagit%2Fp5-mst-13.2.git fix from Larry for parsing C<{ 0x1 => 'foo'}> as an anon hash rather than a block; test case for the same p4raw-id: //depot/perl@4697 --- diff --git a/t/comp/term.t b/t/comp/term.t index eb99680..f079eef 100755 --- a/t/comp/term.t +++ b/t/comp/term.t @@ -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 --- 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++;