This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: For plugins, don’t set PL_expect if PL_nexttoke
authorFather Chrysostomos <sprout@cpan.org>
Sat, 23 Aug 2014 01:11:23 +0000 (18:11 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 25 Aug 2014 02:02:57 +0000 (19:02 -0700)
commit6c893454033f13bf5cdcb81ab0c48637bcd80713
treeacf69a9f111540f65614bcbfa16c14ffe6d76b24
parenta92622bcc30131a0d161a1a90d65475ebafd2329
toke.c: For plugins, don’t set PL_expect if PL_nexttoke

When a parsing plugin finishes parsing its stuff, the lexer may have
emitted one more token than the construct it was parsing (if the
plugin called parsing API functions like parse_fullstmt).  In such
cases, yyunlex has pushed that token on to the pending token stack
with force_next.

When the lexer is about to emit the plugin’s parsed statement or
expression, if there is a pending token, then it does not need to set
PL_expect, since the previous value will be restored anyway when the
pending token is emitted.

The next commit will disable that save-and-restore mechanism for
PL_expect, so we must not assign to it here.
toke.c