From 300a79662624152c3199e03fb601c8faa716fff1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 25 Nov 2002 06:42:10 +0000 Subject: [PATCH] (yyerrlab1): Move this label down, so that the parser does not discard the lookahead token if the user code invokes YYERROR. This change is required for POSIX conformance. --- data/yacc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/data/yacc.c b/data/yacc.c index 462af2e2..4dd7d298 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -912,8 +912,6 @@ yybackup: } else { - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } @@ -1073,13 +1071,7 @@ yyerrlab: #endif /* YYERROR_VERBOSE */ yyerror (]b4_yyerror_args["syntax error"); } - goto yyerrlab1; - -/*----------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action. | -`----------------------------------------------------*/ -yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -1107,7 +1099,13 @@ yyerrlab1: /* Else will try to reuse lookahead token after shifting the error token. */ + goto yyerrlab1; + +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) -- 2.47.2