mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
examples: don't use yysyntax_error_arguments
Suggested by Adrian Vogelsgesang. https://lists.gnu.org/archive/html/bison-patches/2020-02/msg00069.html * data/skeletons/lalr1.java (Context.EMPTY, Context.getToken): New. (Context.yyntokens): Rename as... (Context.NTOKENS): this. Because (i) all the Java coding styles recommend upper case for constants, and (ii) the Java Skeleton exposes Lexer.EOF, not Lexer.YYEOF. * data/skeletons/yacc.c (yyparse_context_token): New. * examples/c/bistromathic/parse.y (yyreport_syntax_error): Don't use yysyntax_error_arguments. * examples/java/calc/Calc.y (yyreportSyntaxError): Likewise.
This commit is contained in:
@@ -1198,6 +1198,10 @@ yyexpected_tokens (const yyparse_context_t *yyctx,
|
||||
return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn);
|
||||
}]])[
|
||||
|
||||
static int
|
||||
yysyntax_error_arguments (const yyparse_context_t *yyctx,
|
||||
int yyarg[], int yyargn) YY_ATTRIBUTE_UNUSED;
|
||||
|
||||
static int
|
||||
yysyntax_error_arguments (const yyparse_context_t *yyctx,
|
||||
int yyarg[], int yyargn)
|
||||
@@ -1251,7 +1255,17 @@ yysyntax_error_arguments (const yyparse_context_t *yyctx,
|
||||
|
||||
]b4_parse_error_case(
|
||||
[custom],
|
||||
[b4_locations_if([[/* The location of this context. */
|
||||
[[/* The token type of the lookahead of this context. */
|
||||
static int
|
||||
yyparse_context_token (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
||||
|
||||
static int
|
||||
yyparse_context_token (const yyparse_context_t *yyctx)
|
||||
{
|
||||
return yyctx->yytoken;
|
||||
}
|
||||
|
||||
]b4_locations_if([[/* The location of the lookahead of this context. */
|
||||
static YYLTYPE *
|
||||
yyparse_context_location (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user