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

@@ -83,10 +83,11 @@ AT_CLEANUP
AT_SETUP([[Installed skeleton file names]])
AT_BISON_OPTION_PUSHDEFS
m4_pushdef([AT_GRAM],
[[%{
#include <stdio.h>
void yyerror (char const *msg);
]AT_YYERROR_DECLARE[
int yylex (void);
%}
@@ -99,12 +100,7 @@ start: ;
%%
void
yyerror (char const *msg)
{
fprintf (stderr, "%s\n", msg);
}
]AT_YYERROR_DEFINE[
int
yylex (void)
{
@@ -139,6 +135,7 @@ AT_PARSER_CHECK([[./input-gram]], [[1]], [],
m4_popdef([AT_GRAM])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP