yacc: fix YYBACKUP.

Reported by David Kastrup:
https://lists.gnu.org/archive/html/bug-bison/2011-10/msg00002.html.

	* data/yacc.c (YYBACKUP): Accept rhs size.
	Restore the proper state value.
	* TODO (YYBACKUP): Make it...
	* tests/actions.at: a new test case.
	* NEWS, THANKS: Update.
This commit is contained in:
Akim Demaille
2012-01-25 16:57:58 +01:00
parent 2c7f50be62
commit d115aad911
5 changed files with 71 additions and 46 deletions

View File

@@ -646,11 +646,12 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (1); \]b4_lac_if([[
YYPOPSTACK (yylen); \
yystate = *yyssp; \]b4_lac_if([[
YY_LAC_DISCARD ("YYBACKUP"); \]])[
goto yybackup; \
} \