mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
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:
@@ -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.
|
||||||
|
|||||||
50
data/yacc.c
50
data/yacc.c
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user