summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-01 22:53:41 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:44:53 -0700
commitc07656ed340bbe7027cae47dc3a85a51910f9d07 (patch)
treede1da4f0fc074f94f9dd87372d258dc3618b1c80 /toke.c
parent764212cf73683dc2fdc86061a1e2cf4193b89919 (diff)
downloadperl-c07656ed340bbe7027cae47dc3a85a51910f9d07.tar.gz
Make &foo respect our sub
This changes &foo to go through S_pending_ident (by setting PL_pending_ident, which causes yylex to defer to S_pending_ident for the next token) the way $foo and %foo do. This necessitated reducing the maximum identifier length of &foo from 252 to 251, making it match @foo, $foo, etc. So somebody’s JAPH might break. :-)
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index 568e6186f2..1a82259553 100644
--- a/toke.c
+++ b/toke.c
@@ -5987,10 +5987,12 @@ Perl_yylex(pTHX)
BAop(OP_BIT_AND);
}
- s = scan_ident(s - 1, PL_bufend, PL_tokenbuf, sizeof PL_tokenbuf, TRUE);
- if (*PL_tokenbuf) {
+ PL_tokenbuf[0] = '&';
+ s = scan_ident(s - 1, PL_bufend, PL_tokenbuf + 1,
+ sizeof PL_tokenbuf - 1, TRUE);
+ if (PL_tokenbuf[1]) {
PL_expect = XOPERATOR;
- force_ident(PL_tokenbuf, '&');
+ PL_pending_ident = '&';
}
else
PREREF('&');