mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
tests: factor the declaration/definition of yyerror and yylex.
* tests/local.at (AT_YYERROR_DECLARE, AT_YYERROR_DECLARE_EXTERN) (AT_YYERROR_DEFINE, AT_YYLEX_DECLARE, AT_YYLEX_DECLARE_EXTERN) (AT_YYLEX_DEFINE): New. Must be used inside AT_BISON_OPTION_PUSHDEFS/POPDEFS pair. * tests/actions.at, tests/conflicts.at, tests/glr-regression.at, * tests/headers.at, tests/input.at, tests/named-refs.at, * tests/regression.at, tests/skeletons.at, tests/synclines.at, * tests/torture.at: Use them.
This commit is contained in:
@@ -468,8 +468,8 @@ char quote[] = "@:>@@:>@,";
|
||||
%}
|
||||
|
||||
%{
|
||||
static void yyerror (const char *s);
|
||||
static int yylex (void);
|
||||
]AT_YYERROR_DECLARE[
|
||||
]AT_YYLEX_DECLARE[
|
||||
%}
|
||||
|
||||
%type <ival> '@<:@'
|
||||
@@ -621,14 +621,15 @@ AT_CLEANUP
|
||||
|
||||
AT_SETUP([Symbols])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[[%token WITH-DASH
|
||||
%token WITHOUT_DASH "WITHOUT-DASH"
|
||||
%token WITH.PERIOD
|
||||
%token WITHOUT_PERIOD "WITHOUT.PERIOD"
|
||||
%code {
|
||||
void yyerror (char const *);
|
||||
int yylex (void);
|
||||
]AT_YYERROR_DECLARE[
|
||||
]AT_YYLEX_DECLARE[
|
||||
}
|
||||
%%
|
||||
start: with-dash without_dash with.period without_period;
|
||||
@@ -637,7 +638,10 @@ without_dash: "WITHOUT-DASH";
|
||||
with.period: WITH.PERIOD;
|
||||
without_period: "WITHOUT.PERIOD";
|
||||
%%
|
||||
]AT_YYERROR_DEFINE[
|
||||
]AT_YYLEX_DEFINE[
|
||||
]])
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
# POSIX Yacc accept periods, but not dashes.
|
||||
AT_BISON_CHECK([--yacc input.y], [1], [],
|
||||
|
||||
Reference in New Issue
Block a user