default:
break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action
+ invokes YYABORT, YYACCEPT, or YYERROR immediately after altering
+ yychar. In the case of YYABORT or YYACCEPT, an incorrect
+ destructor might then be invoked immediately. In the case of
+ YYERROR, subsequent parser actions might lead to an incorrect
+ destructor call or verbose syntax error message before the
+ lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
yypop_ (yylen);
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yytranslate_ (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus_)
{
yyreturn:
if (yychar != yyempty_)
- yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
+ {
+ /* Make sure we have latest lookahead translation. See comments
+ at user semantic actions for why this is necessary. */
+ yytoken = yytranslate_ (yychar);
+ yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval,
+ &yylloc);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */