mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +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:
@@ -386,7 +386,7 @@ AT_CLEANUP
|
||||
|
||||
AT_SETUP([Torturing the Scanner])
|
||||
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS
|
||||
AT_DATA([input.y], [])
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:1.1: syntax error, unexpected end of file
|
||||
@@ -463,8 +463,8 @@ char quote[] = "@:>@@:>@,";
|
||||
%}
|
||||
|
||||
%{
|
||||
static void yyerror (const char *s);
|
||||
static int yylex (void);
|
||||
]AT_YYERROR_DECLARE[
|
||||
]AT_YYLEX_DECLARE[
|
||||
%}
|
||||
|
||||
%type <ival> '@<:@'
|
||||
@@ -496,7 +496,7 @@ value_as_yystype (value val)
|
||||
res.ival = val;
|
||||
return res;
|
||||
}
|
||||
|
||||
]AT_YYERROR_DEFINE[
|
||||
static int
|
||||
yylex (void)
|
||||
{
|
||||
@@ -509,12 +509,6 @@ yylex (void)
|
||||
yylval = value_as_yystype (input[toknum]);
|
||||
return input[toknum++];
|
||||
}
|
||||
|
||||
static void
|
||||
yyerror (const char *msg)
|
||||
{
|
||||
fprintf (stderr, "%s\n", msg);
|
||||
}
|
||||
]])
|
||||
|
||||
# Pacify Emacs'font-lock-mode: "
|
||||
@@ -531,6 +525,7 @@ main (void)
|
||||
return yyparse ();
|
||||
}
|
||||
]])
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_BISON_CHECK([-d -v -o input.c input.y])
|
||||
AT_COMPILE([input.o], [-c input.c])
|
||||
@@ -616,14 +611,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;
|
||||
@@ -632,7 +628,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