This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #105924] require 1 << 2
authorFather Chrysostomos <sprout@cpan.org>
Thu, 20 Sep 2012 13:24:25 +0000 (06:24 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 20 Sep 2012 15:37:58 +0000 (08:37 -0700)
commitc31f6d3b869d78bbd101e694fd3b384b47a77f6d
tree8835bcb86728561b08945b6d7f5c35c36033b8b4
parenta310a8f2bf41061e1bf6feadf7d6758f96b481c5
[perl #105924] require 1 << 2

Setting PL_expect after force_next has no effect, as force_next
(called by force_version and force_word) picks up the current value of
PL_expect and arranges for it to be reset thereto after the forced
token is force-fed to the parser.

The KEY_require case should be setting PL_expect to XTERM (as it
already does) when there is no forced token (version or bareword),
because we expect a term after ‘require’, but to XOPERATOR when
there is a forced token, because we expect an operator after that
forced token.

Since the PL_expect assignment has no effect after force_next, we can
set it to XOPERATOR before calling potentially calling force_next, and
then to XTERM afterwards.

Loop exits had the same bug, so this fixes them all.
t/base/lex.t
toke.c