mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
yacc.c: let custom error messages see the location
* data/skeletons/yacc.c (yyparse_context_t): Add yylloc when applicable. (yyparse_context_location): New. * tests/local.at (AT_YYERROR_DEFINE(c)): Handle the location. * tests/calc.at: Check it.
This commit is contained in:
@@ -619,7 +619,9 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
|
||||
if (n == -2)
|
||||
return 2;
|
||||
if (n)
|
||||
{
|
||||
{]AT_LOCATION_IF([[
|
||||
LOCATION_PRINT (stderr, *yyparse_context_location (ctx));
|
||||
fprintf (stderr, ": ");]])[
|
||||
fprintf (stderr, "syntax error on token [%s]", yysymbol_name (arg[0]));
|
||||
if (1 < n)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user