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.
} else if (result == KEYWORD_PLUGIN_STMT) {
pl_yylval.opval = o;
CLINE;
- PL_expect = XSTATE;
+ if (!PL_nexttoke) PL_expect = XSTATE;
return REPORT(PLUGSTMT);
} else if (result == KEYWORD_PLUGIN_EXPR) {
pl_yylval.opval = o;
CLINE;
- PL_expect = XOPERATOR;
+ if (!PL_nexttoke) PL_expect = XOPERATOR;
return REPORT(PLUGEXPR);
} else {
Perl_croak(aTHX_ "Bad plugin affecting keyword '%s'",