diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-07-01 22:53:41 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-15 22:44:53 -0700 |
commit | c07656ed340bbe7027cae47dc3a85a51910f9d07 (patch) | |
tree | de1da4f0fc074f94f9dd87372d258dc3618b1c80 /toke.c | |
parent | 764212cf73683dc2fdc86061a1e2cf4193b89919 (diff) | |
download | perl-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.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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('&'); |