mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
tests: handle %parse-param in the generated yyerror
* tests/local.at (AT_PARSE_PARAMS): New. (AT_YYERROR_FORMALS, AT_YYERROR_DEFINE): Use it to add the parse-param to yyerror. * tests/calc.at, tests/regression.at: Use AT_YYERROR_DEFINE and AT_YYERROR_DECLARE, now that they handle properly the parse-params. Be sure to let AT_BISON_OPTION_PUSHDEFS now what parse-params are used.
This commit is contained in:
@@ -280,11 +280,7 @@ AT_SKEL_CC_IF(
|
||||
FILE *input;
|
||||
static int power (int base, int exponent);
|
||||
|
||||
]AT_SKEL_CC_IF(,
|
||||
[static void yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
|
||||
AT_PARAM_IF([semantic_value *result, int *count, ])
|
||||
const char *s
|
||||
);])[
|
||||
]AT_YYERROR_DECLARE[
|
||||
]AT_YYLEX_DECLARE_EXTERN[
|
||||
}
|
||||
|
||||
@@ -365,27 +361,8 @@ power (int base, int exponent)
|
||||
o << '-' << s.last.c - 1;
|
||||
return o;
|
||||
}
|
||||
]])
|
||||
AT_YYERROR_DEFINE],
|
||||
[/* A C error reporting function. */
|
||||
static void
|
||||
yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
|
||||
AT_PARAM_IF([semantic_value *result, int *count, ])
|
||||
const char *s)
|
||||
{
|
||||
AT_PARAM_IF([(void) result; (void) count;])
|
||||
AT_YYERROR_SEES_LOC_IF([
|
||||
fprintf (stderr, "%d.%d",
|
||||
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);
|
||||
if (AT_LOC_FIRST_LINE != AT_LOC_LAST_LINE)
|
||||
fprintf (stderr, "-%d.%d",
|
||||
AT_LOC_LAST_LINE, AT_LOC_LAST_COLUMN - 1);
|
||||
else if (AT_LOC_FIRST_COLUMN != AT_LOC_LAST_COLUMN - 1)
|
||||
fprintf (stderr, "-%d",
|
||||
AT_LOC_LAST_COLUMN - 1);
|
||||
fprintf (stderr, ": ");])
|
||||
fprintf (stderr, "%s\n", s);
|
||||
}])[
|
||||
]])])[
|
||||
]AT_YYERROR_DEFINE[
|
||||
]AT_DEFINES_IF([],
|
||||
[AT_CALC_LEX
|
||||
AT_CALC_MAIN])])
|
||||
|
||||
Reference in New Issue
Block a user