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:
Akim Demaille
2012-06-17 18:01:14 +02:00
parent 34d867d7d2
commit 55f48c4831
11 changed files with 378 additions and 599 deletions

View File

@@ -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], [],