In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/e9d2327de9f57c23ca9f4b2b17818e696b0b031e?hp=7ce06b7dca2247fac16c28cd064f3949998cb06e>
- Log ----------------------------------------------------------------- commit e9d2327de9f57c23ca9f4b2b17818e696b0b031e Author: Father Chrysostomos <[email protected]> Date: Mon Sep 24 18:18:42 2012 -0700 [perl #56880] Allow v10 as a label or package name ----------------------------------------------------------------------- Summary of changes: t/base/lex.t | 22 +++++++++++++++++++++- toke.c | 10 +++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/t/base/lex.t b/t/base/lex.t index bca43b4..b1c4a09 100644 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -1,6 +1,6 @@ #!./perl -print "1..81\n"; +print "1..85\n"; $x = 'x'; @@ -380,3 +380,23 @@ for(qw< require goto last next redo dump >) { print "ok ", $test++, " - [perl #105924] $_ WORD << ...\n"; print "# $@" if $@; } + +# http://rt.perl.org/rt3/Ticket/Display.html?id=56880 +my $counter = 0; +eval 'v23: $counter++; goto v23 unless $counter == 2'; +print "not " unless $counter == 2; +print "ok 82 - Use v[0-9]+ as a label\n"; +$counter = 0; +eval 'v23 : $counter++; goto v23 unless $counter == 2'; +print "not " unless $counter == 2; +print "ok 83 - Use v[0-9]+ as a label with space before colon\n"; + +my $output = ""; +eval "package v10::foo; sub test2 { return 'v10::foo' } + package v10; sub test { return v10::foo::test2(); } + package main; \$output = v10::test(); "; +print "not " unless $output eq 'v10::foo'; +print "ok 84 - call a function in package v10::foo\n"; + +print "not " unless (1?v65:"bar") eq 'A'; +print "ok 85 - colon detection after vstring does not break ? vstring :\n"; diff --git a/toke.c b/toke.c index d225514..e9a06eb 100644 --- a/toke.c +++ b/toke.c @@ -6553,8 +6553,16 @@ Perl_yylex(pTHX) s = scan_num(s, &pl_yylval); TERM(THING); } + else if ((*start == ':' && start[1] == ':') + || (PL_expect == XSTATE && *start == ':')) + goto keylookup; + else if (PL_expect == XSTATE) { + d = start; + while (d < PL_bufend && isSPACE(*d)) d++; + if (*d == ':') goto keylookup; + } /* avoid v123abc() or $h{v1}, allow C<print v10;> */ - else if (!isALPHA(*start) && (PL_expect == XTERM + if (!isALPHA(*start) && (PL_expect == XTERM || PL_expect == XREF || PL_expect == XSTATE || PL_expect == XTERMORDORDOR)) { GV *const gv = gv_fetchpvn_flags(s, start - s, -- Perl5 Master Repository
