summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-03-10 22:00:41 -0700
committerFather Chrysostomos <sprout@cpan.org>2015-03-10 23:20:57 -0700
commit9d58dbc453a86c9cbb3a131adcd1559fe0445a08 (patch)
tree873e2f008cf58aa31ece614c003b49ccf3520472
parent0635704a987a9ec0c9983c4b01b19624fafe668a (diff)
downloadperl-9d58dbc453a86c9cbb3a131adcd1559fe0445a08.tar.gz
[perl #123963] "@<fullwidth digit>"
If an @ sign in a double-quoted string is not followed by a valid identifier, then it is treated literally. Or at least that is how it was intended to work. The lexer was actually not self-consistent. It was treating non-ASCII digits at valid identifiers in determining where the interpolation started, but was not treating them as valid identifiers when actually parsing the interpolated code. So this would result in syntax errors, and even crashes in some cases.
-rw-r--r--t/op/lex.t5
-rw-r--r--toke.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/t/op/lex.t b/t/op/lex.t
index 7785445c44..8314f41256 100644
--- a/t/op/lex.t
+++ b/t/op/lex.t
@@ -7,7 +7,7 @@ use warnings;
BEGIN { chdir 't' if -d 't'; require './test.pl'; }
-plan(tests => 23);
+plan(tests => 24);
{
no warnings 'deprecated';
@@ -199,3 +199,6 @@ fresh_perl_is(
{ stderr => 1 },
'<\L\L> with no newline [perl #123802]'
);
+
+is eval "qq'@\x{ff13}'", "\@\x{ff13}",
+ '"@<fullwidth digit>" [perl #123963]';
diff --git a/toke.c b/toke.c
index 9715f0e157..bfcb060abe 100644
--- a/toke.c
+++ b/toke.c
@@ -3056,7 +3056,7 @@ S_scan_const(pTHX_ char *start)
(@foo, @::foo, @'foo, @{foo}, @$foo, @+, @-)
*/
else if (*s == '@' && s[1]) {
- if (isWORDCHAR_lazy_if(s+1,UTF))
+ if (UTF ? isIDFIRST_utf8((U8*)s+1) : isWORDCHAR_A(s[1]))
break;
if (strchr(":'{$", s[1]))
break;