mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 18:53:04 +00:00
Merge remote-tracking branch 'origin/maint'
* origin/maint: maint: formatting changes. tests: support api.prefix. tests: pacify font-lock-mode. tests: remove test covered elsewhere. tests: factor the declaration/definition of yyerror and yylex. regen. tests: portability issues. tests: call the parser from another compilation unit. glr.c, yacc.c: declare yydebug in the header. skeletons: use header guards. tests: improve AT_FULL_COMPILE. tests: reorder. tests: strengthen the test on generated headers inclusion yacc.c: instead of duplicating y.tab.h inside y.tac.c, include it. yacc.c: factor. Conflicts: NEWS data/glr.c data/yacc.c src/parse-gram.c src/parse-gram.h tests/conflicts.at tests/regression.at
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
AT_BANNER([[Named references tests.]])
|
||||
|
||||
AT_SETUP([Tutorial calculator])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS
|
||||
AT_DATA_GRAMMAR([test.y],
|
||||
[[
|
||||
%{
|
||||
@@ -33,8 +33,8 @@ FILE *input;
|
||||
static semantic_value global_result = 0;
|
||||
static int global_count = 0;
|
||||
static int power (int base, int exponent);
|
||||
static void yyerror (const char *s);
|
||||
int yylex (void);
|
||||
]AT_YYERROR_DECLARE[
|
||||
]AT_YYLEX_DECLARE[
|
||||
%}
|
||||
|
||||
%union
|
||||
@@ -83,12 +83,7 @@ exp:
|
||||
| '-' error { $$ = 0; YYERROR; }
|
||||
;
|
||||
%%
|
||||
|
||||
static void yyerror (const char *s)
|
||||
{
|
||||
fprintf (stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
]AT_YYERROR_DEFINE[
|
||||
static int get_char (void)
|
||||
{
|
||||
int res = getc (input);
|
||||
@@ -119,7 +114,8 @@ static int read_signed_integer (void)
|
||||
return sign * n;
|
||||
}
|
||||
|
||||
int yylex (void)
|
||||
static int
|
||||
yylex (void)
|
||||
{
|
||||
int c;
|
||||
/* Skip white space. */
|
||||
@@ -190,6 +186,7 @@ AT_DATA([input.txt],
|
||||
AT_BISON_CHECK([-o test.c test.y])
|
||||
AT_COMPILE([[test]])
|
||||
AT_PARSER_CHECK([./test input.txt], 0, [], [stderr])
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
@@ -198,13 +195,13 @@ AT_CLEANUP
|
||||
|
||||
|
||||
AT_SETUP([Undefined and ambiguous references])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS
|
||||
AT_DATA_GRAMMAR([test.y],
|
||||
[[
|
||||
%{
|
||||
static int power (int base, int exponent);
|
||||
static void yyerror (const char *s);
|
||||
int yylex (void);
|
||||
]AT_YYERROR_DECLARE[
|
||||
]AT_YYLEX_DECLARE[
|
||||
%}
|
||||
|
||||
%union
|
||||
@@ -268,6 +265,7 @@ test.y:55.3-53: symbol not found in production: r12
|
||||
test.y:56.29-33: invalid reference: '$expo'
|
||||
test.y:56.3-46: symbol not found in production: expo
|
||||
]])
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
AT_CLEANUP
|
||||
|
||||
#######################################################################
|
||||
|
||||
Reference in New Issue
Block a user