yysyntax_error: improve invocation readability.

* data/yacc.c (yyparse, yypush_parse): For yysyntax_error
invocation, get rid of the while loop, which is misleading
because there are really at most two iterations.
This commit is contained in:
Joel E. Denny
2010-10-31 18:56:34 -04:00
parent 9d6bc5c402
commit 34db451c37
2 changed files with 35 additions and 22 deletions

View File

@@ -1,3 +1,10 @@
2010-10-31 Joel E. Denny <joeldenny@joeldenny.org>
yysyntax_error: improve invocation readability.
* data/yacc.c (yyparse, yypush_parse): For yysyntax_error
invocation, get rid of the while loop, which is misleading
because there are really at most two iterations.
2010-10-31 Joel E. Denny <joeldenny@joeldenny.org> 2010-10-31 Joel E. Denny <joeldenny@joeldenny.org>
* ChangeLog: Correct some errors in previous entries. * ChangeLog: Correct some errors in previous entries.

View File

@@ -1477,28 +1477,34 @@ yyerrlab:
#if ! YYERROR_VERBOSE #if ! YYERROR_VERBOSE
yyerror (]b4_yyerror_args[YY_("syntax error")); yyerror (]b4_yyerror_args[YY_("syntax error"));
#else #else
while (1) # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, yystate, \
{ yytoken)
int yysyntax_error_status = {
yysyntax_error (&yymsg_alloc, &yymsg, yystate, yytoken); char const *yymsgp = YY_("syntax error");
if (yysyntax_error_status == 2 && 0 < yymsg_alloc) int yysyntax_error_status = YYSYNTAX_ERROR;
{ if (yysyntax_error_status == 0)
if (yymsg != yymsgbuf) yymsgp = yymsg;
YYSTACK_FREE (yymsg); else if (yysyntax_error_status == 2 && 0 < yymsg_alloc)
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); {
if (yymsg) if (yymsg != yymsgbuf)
continue; YYSTACK_FREE (yymsg);
yymsg = yymsgbuf; yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
yymsg_alloc = sizeof yymsgbuf; if (!yymsg)
} {
if (yysyntax_error_status == 0) yymsg = yymsgbuf;
yyerror (]b4_yyerror_args[yymsg); yymsg_alloc = sizeof yymsgbuf;
else }
yyerror (]b4_yyerror_args[YY_("syntax error")); else
if (yysyntax_error_status == 2) {
goto yyexhaustedlab; yysyntax_error_status = YYSYNTAX_ERROR;
break; yymsgp = yymsg;
} }
}
yyerror (]b4_yyerror_args[yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif #endif
} }