mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c: rename yyparse_context_t as yypcontext_t
The first name is too long. We already have `yypstate`, so `yypcontext` is ok. We are also migrating to using `*_t` for our types. * NEWS, data/skeletons/glr.c, data/skeletons/yacc.c, doc/bison.texi, * examples/c/bistromathic/parse.y, src/parse-gram.y, tests/local.at: (yyparse_context_t, yyparse_context_location, yyparse_context_token): Rename as... (yypcontext_t, yypcontext_location, yypcontext_token): these.
This commit is contained in:
4
NEWS
4
NEWS
@@ -37,14 +37,14 @@ GNU Bison NEWS
|
|||||||
herself by defining a function such as:
|
herself by defining a function such as:
|
||||||
|
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yyparse_context_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx)
|
||||||
{
|
{
|
||||||
enum { ARGMAX = 10 };
|
enum { ARGMAX = 10 };
|
||||||
int arg[ARGMAX];
|
int arg[ARGMAX];
|
||||||
int n = yysyntax_error_arguments (ctx, arg, ARGMAX);
|
int n = yysyntax_error_arguments (ctx, arg, ARGMAX);
|
||||||
if (n == -2)
|
if (n == -2)
|
||||||
return 2; // Memory exhausted.
|
return 2; // Memory exhausted.
|
||||||
YY_LOCATION_PRINT (stderr, *yyparse_context_location (ctx));
|
YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
|
||||||
fprintf (stderr, ": syntax error");
|
fprintf (stderr, ": syntax error");
|
||||||
for (int i = 1; i < n; ++i)
|
for (int i = 1; i < n; ++i)
|
||||||
fprintf (stderr, " %s %s",
|
fprintf (stderr, " %s %s",
|
||||||
|
|||||||
@@ -2123,16 +2123,16 @@ yyexpected_tokens (const yyGLRStack* yystackp,
|
|||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
[custom],
|
[custom],
|
||||||
[[/* User defined function to report a syntax error. */
|
[[/* User defined function to report a syntax error. */
|
||||||
typedef yyGLRStack yyparse_context_t;
|
typedef yyGLRStack yypcontext_t;
|
||||||
static int
|
static int
|
||||||
yyreport_syntax_error (const yyGLRStack* yystackp]b4_user_formals[);
|
yyreport_syntax_error (const yyGLRStack* yystackp]b4_user_formals[);
|
||||||
|
|
||||||
/* The token type of the lookahead of this context. */
|
/* The token type of the lookahead of this context. */
|
||||||
static yysymbol_type_t
|
static yysymbol_type_t
|
||||||
yyparse_context_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static yysymbol_type_t
|
static yysymbol_type_t
|
||||||
yyparse_context_token (const yyGLRStack *yystackp)
|
yypcontext_token (const yyGLRStack *yystackp)
|
||||||
{
|
{
|
||||||
YYUSE (yystackp);
|
YYUSE (yystackp);
|
||||||
yysymbol_type_t yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
yysymbol_type_t yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
||||||
@@ -2141,10 +2141,10 @@ yyparse_context_token (const yyGLRStack *yystackp)
|
|||||||
|
|
||||||
]b4_locations_if([[/* The location of the lookahead of this context. */
|
]b4_locations_if([[/* The location of the lookahead of this context. */
|
||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yyparse_context_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yyparse_context_location (const yyGLRStack *yystackp)
|
yypcontext_location (const yyGLRStack *yystackp)
|
||||||
{
|
{
|
||||||
YYUSE (yystackp);
|
YYUSE (yystackp);
|
||||||
return &yylloc;
|
return &yylloc;
|
||||||
|
|||||||
@@ -1132,7 +1132,7 @@ typedef struct
|
|||||||
YYPTRDIFF_T *yyes_capacity;]])])[
|
YYPTRDIFF_T *yyes_capacity;]])])[
|
||||||
yysymbol_type_t yytoken;]b4_locations_if([[
|
yysymbol_type_t yytoken;]b4_locations_if([[
|
||||||
YYLTYPE *yylloc;]])[
|
YYLTYPE *yylloc;]])[
|
||||||
} yyparse_context_t;
|
} yypcontext_t;
|
||||||
|
|
||||||
/* Put in YYARG at most YYARGN of the expected tokens given the
|
/* Put in YYARG at most YYARGN of the expected tokens given the
|
||||||
current YYCTX, and return the number of tokens stored in YYARG. If
|
current YYCTX, and return the number of tokens stored in YYARG. If
|
||||||
@@ -1144,7 +1144,7 @@ static int
|
|||||||
yypstate_expected_tokens (yypstate *yyps,
|
yypstate_expected_tokens (yypstate *yyps,
|
||||||
yysymbol_type_t yyarg[], int yyargn)]], [[
|
yysymbol_type_t yyarg[], int yyargn)]], [[
|
||||||
static int
|
static int
|
||||||
yyexpected_tokens (const yyparse_context_t *yyctx,
|
yyexpected_tokens (const yypcontext_t *yyctx,
|
||||||
yysymbol_type_t yyarg[], int yyargn)]])[
|
yysymbol_type_t yyarg[], int yyargn)]])[
|
||||||
{
|
{
|
||||||
/* Actual size of YYARG. */
|
/* Actual size of YYARG. */
|
||||||
@@ -1200,7 +1200,7 @@ yyexpected_tokens (const yyparse_context_t *yyctx,
|
|||||||
]b4_push_if([[
|
]b4_push_if([[
|
||||||
/* Similar to the previous function. */
|
/* Similar to the previous function. */
|
||||||
static int
|
static int
|
||||||
yyexpected_tokens (const yyparse_context_t *yyctx,
|
yyexpected_tokens (const yypcontext_t *yyctx,
|
||||||
yysymbol_type_t yyarg[], int yyargn)
|
yysymbol_type_t yyarg[], int yyargn)
|
||||||
{
|
{
|
||||||
return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn);
|
return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn);
|
||||||
@@ -1211,27 +1211,27 @@ yyexpected_tokens (const yyparse_context_t *yyctx,
|
|||||||
[custom],
|
[custom],
|
||||||
[[/* The token type of the lookahead of this context. */
|
[[/* The token type of the lookahead of this context. */
|
||||||
static yysymbol_type_t
|
static yysymbol_type_t
|
||||||
yyparse_context_token (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static yysymbol_type_t
|
static yysymbol_type_t
|
||||||
yyparse_context_token (const yyparse_context_t *yyctx)
|
yypcontext_token (const yypcontext_t *yyctx)
|
||||||
{
|
{
|
||||||
return yyctx->yytoken;
|
return yyctx->yytoken;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([[/* The location of the lookahead of this context. */
|
]b4_locations_if([[/* The location of the lookahead of this context. */
|
||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yyparse_context_location (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
yypcontext_location (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yyparse_context_location (const yyparse_context_t *yyctx)
|
yypcontext_location (const yypcontext_t *yyctx)
|
||||||
{
|
{
|
||||||
return yyctx->yylloc;
|
return yyctx->yylloc;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* User defined function to report a syntax error. */
|
/* User defined function to report a syntax error. */
|
||||||
static int
|
static int
|
||||||
yyreport_syntax_error (const yyparse_context_t *yyctx]b4_user_formals[);]],
|
yyreport_syntax_error (const yypcontext_t *yyctx]b4_user_formals[);]],
|
||||||
[detailed\|verbose],
|
[detailed\|verbose],
|
||||||
[[#ifndef yystrlen
|
[[#ifndef yystrlen
|
||||||
# if defined __GLIBC__ && defined _STRING_H
|
# if defined __GLIBC__ && defined _STRING_H
|
||||||
@@ -1323,7 +1323,7 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
]])[
|
]])[
|
||||||
|
|
||||||
static int
|
static int
|
||||||
yysyntax_error_arguments (const yyparse_context_t *yyctx,
|
yysyntax_error_arguments (const yypcontext_t *yyctx,
|
||||||
yysymbol_type_t yyarg[], int yyargn)
|
yysymbol_type_t yyarg[], int yyargn)
|
||||||
{
|
{
|
||||||
/* Actual size of YYARG. */
|
/* Actual size of YYARG. */
|
||||||
@@ -1384,7 +1384,7 @@ yysyntax_error_arguments (const yyparse_context_t *yyctx,
|
|||||||
yy_lac returned YYNOMEM]])[. */
|
yy_lac returned YYNOMEM]])[. */
|
||||||
static int
|
static int
|
||||||
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
||||||
const yyparse_context_t *yyctx)
|
const yypcontext_t *yyctx)
|
||||||
{
|
{
|
||||||
enum { YYARGS_MAX = 5 };
|
enum { YYARGS_MAX = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
@@ -1906,7 +1906,7 @@ yyerrlab:
|
|||||||
]b4_parse_error_case(
|
]b4_parse_error_case(
|
||||||
[custom],
|
[custom],
|
||||||
[[ {
|
[[ {
|
||||||
yyparse_context_t yyctx
|
yypcontext_t yyctx
|
||||||
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[
|
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
YY_LAC_ESTABLISH;]])[
|
YY_LAC_ESTABLISH;]])[
|
||||||
@@ -1917,7 +1917,7 @@ yyerrlab:
|
|||||||
[simple],
|
[simple],
|
||||||
[[ yyerror (]b4_yyerror_args[YY_("syntax error"));]],
|
[[ yyerror (]b4_yyerror_args[YY_("syntax error"));]],
|
||||||
[[ {
|
[[ {
|
||||||
yyparse_context_t yyctx
|
yypcontext_t yyctx
|
||||||
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};
|
= {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};
|
||||||
char const *yymsgp = YY_("syntax error");
|
char const *yymsgp = YY_("syntax error");
|
||||||
int yysyntax_error_status;]b4_lac_if([[
|
int yysyntax_error_status;]b4_lac_if([[
|
||||||
|
|||||||
@@ -7396,19 +7396,19 @@ Declarations}), then the parser no longer passes syntax error messages to
|
|||||||
@code{yyerror}, rather it leaves that task to the user by calling the
|
@code{yyerror}, rather it leaves that task to the user by calling the
|
||||||
@code{yyreport_syntax_error} function.
|
@code{yyreport_syntax_error} function.
|
||||||
|
|
||||||
@deftypefun int yyreport_syntax_error (@code{const yyparse_context_t *}@var{ctx})
|
@deftypefun int yyreport_syntax_error (@code{const yypcontext_t *}@var{ctx})
|
||||||
Report a syntax error to the user. Return 0 on success, 2 on memory
|
Report a syntax error to the user. Return 0 on success, 2 on memory
|
||||||
exhaustion. Whether it uses @code{yyerror} is up to the user.
|
exhaustion. Whether it uses @code{yyerror} is up to the user.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
Use the following functions to build the error message.
|
Use the following functions to build the error message.
|
||||||
|
|
||||||
@deftypefun {YYLTYPE *} yyparse_context_location (@code{const yyparse_context_t *}@var{ctx})
|
@deftypefun {YYLTYPE *} yypcontext_location (@code{const yypcontext_t *}@var{ctx})
|
||||||
The location of the syntax error.
|
The location of the syntax error.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
|
||||||
@deftypefun int yysyntax_error_arguments (@code{const yyparse_context_t *}ctx, @code{int} @var{argv}@code{[]}, @code{int} @var{argc})
|
@deftypefun int yysyntax_error_arguments (@code{const yypcontext_t *}ctx, @code{int} @var{argv}@code{[]}, @code{int} @var{argc})
|
||||||
Fill @var{argv} with first the internal number of the token that caused the
|
Fill @var{argv} with first the internal number of the token that caused the
|
||||||
error, then the internal numbers of the expected tokens. Never put more
|
error, then the internal numbers of the expected tokens. Never put more
|
||||||
than @var{argc} elements into @var{argv}, and on success return the
|
than @var{argc} elements into @var{argv}, and on success return the
|
||||||
@@ -7428,7 +7428,7 @@ A custom syntax error function looks as follows.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yyparse_context_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx)
|
||||||
@{
|
@{
|
||||||
enum @{ ARGMAX = 10 @};
|
enum @{ ARGMAX = 10 @};
|
||||||
int arg[ARGMAX];
|
int arg[ARGMAX];
|
||||||
|
|||||||
@@ -282,10 +282,10 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
`---------*/
|
`---------*/
|
||||||
|
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yyparse_context_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
YY_LOCATION_PRINT (stderr, *yyparse_context_location (ctx));
|
YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
|
||||||
fprintf (stderr, ": syntax error");
|
fprintf (stderr, ": syntax error");
|
||||||
{
|
{
|
||||||
enum { TOKENMAX = 10 };
|
enum { TOKENMAX = 10 };
|
||||||
@@ -300,7 +300,7 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
|
|||||||
i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
|
i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
yysymbol_type_t lookahead = yyparse_context_token (ctx);
|
yysymbol_type_t lookahead = yypcontext_token (ctx);
|
||||||
if (lookahead != YYEMPTY)
|
if (lookahead != YYEMPTY)
|
||||||
fprintf (stderr, " before %s", yysymbol_name (lookahead));
|
fprintf (stderr, " before %s", yysymbol_name (lookahead));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1592,7 +1592,7 @@ typedef struct
|
|||||||
YYPTRDIFF_T *yyes_capacity;
|
YYPTRDIFF_T *yyes_capacity;
|
||||||
yysymbol_type_t yytoken;
|
yysymbol_type_t yytoken;
|
||||||
YYLTYPE *yylloc;
|
YYLTYPE *yylloc;
|
||||||
} yyparse_context_t;
|
} yypcontext_t;
|
||||||
|
|
||||||
/* Put in YYARG at most YYARGN of the expected tokens given the
|
/* Put in YYARG at most YYARGN of the expected tokens given the
|
||||||
current YYCTX, and return the number of tokens stored in YYARG. If
|
current YYCTX, and return the number of tokens stored in YYARG. If
|
||||||
@@ -1601,7 +1601,7 @@ typedef struct
|
|||||||
Return 0 if there are more than YYARGN expected tokens, yet fill
|
Return 0 if there are more than YYARGN expected tokens, yet fill
|
||||||
YYARG up to YYARGN. */
|
YYARG up to YYARGN. */
|
||||||
static int
|
static int
|
||||||
yyexpected_tokens (const yyparse_context_t *yyctx,
|
yyexpected_tokens (const yypcontext_t *yyctx,
|
||||||
yysymbol_type_t yyarg[], int yyargn)
|
yysymbol_type_t yyarg[], int yyargn)
|
||||||
{
|
{
|
||||||
/* Actual size of YYARG. */
|
/* Actual size of YYARG. */
|
||||||
@@ -1635,27 +1635,27 @@ yyexpected_tokens (const yyparse_context_t *yyctx,
|
|||||||
|
|
||||||
/* The token type of the lookahead of this context. */
|
/* The token type of the lookahead of this context. */
|
||||||
static yysymbol_type_t
|
static yysymbol_type_t
|
||||||
yyparse_context_token (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static yysymbol_type_t
|
static yysymbol_type_t
|
||||||
yyparse_context_token (const yyparse_context_t *yyctx)
|
yypcontext_token (const yypcontext_t *yyctx)
|
||||||
{
|
{
|
||||||
return yyctx->yytoken;
|
return yyctx->yytoken;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The location of the lookahead of this context. */
|
/* The location of the lookahead of this context. */
|
||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yyparse_context_location (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
yypcontext_location (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
static YYLTYPE *
|
static YYLTYPE *
|
||||||
yyparse_context_location (const yyparse_context_t *yyctx)
|
yypcontext_location (const yypcontext_t *yyctx)
|
||||||
{
|
{
|
||||||
return yyctx->yylloc;
|
return yyctx->yylloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* User defined function to report a syntax error. */
|
/* User defined function to report a syntax error. */
|
||||||
static int
|
static int
|
||||||
yyreport_syntax_error (const yyparse_context_t *yyctx);
|
yyreport_syntax_error (const yypcontext_t *yyctx);
|
||||||
|
|
||||||
/*-----------------------------------------------.
|
/*-----------------------------------------------.
|
||||||
| Release the memory associated to this symbol. |
|
| Release the memory associated to this symbol. |
|
||||||
@@ -2630,7 +2630,7 @@ yyerrlab:
|
|||||||
{
|
{
|
||||||
++yynerrs;
|
++yynerrs;
|
||||||
{
|
{
|
||||||
yyparse_context_t yyctx
|
yypcontext_t yyctx
|
||||||
= {yyssp, yyesa, &yyes, &yyes_capacity, yytoken, &yylloc};
|
= {yyssp, yyesa, &yyes, &yyes_capacity, yytoken, &yylloc};
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
YY_LAC_ESTABLISH;
|
YY_LAC_ESTABLISH;
|
||||||
@@ -2798,7 +2798,7 @@ yyreturn:
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yyparse_context_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
/* Arguments of format: reported tokens (one for the "unexpected",
|
/* Arguments of format: reported tokens (one for the "unexpected",
|
||||||
@@ -2806,7 +2806,7 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
|
|||||||
enum { ARGS_MAX = 5 };
|
enum { ARGS_MAX = 5 };
|
||||||
const char *argv[ARGS_MAX];
|
const char *argv[ARGS_MAX];
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
yysymbol_type_t unexpected = yyparse_context_token (ctx);
|
yysymbol_type_t unexpected = yypcontext_token (ctx);
|
||||||
if (unexpected != YYSYMBOL_YYEMPTY)
|
if (unexpected != YYSYMBOL_YYEMPTY)
|
||||||
{
|
{
|
||||||
argv[argc++] = yysymbol_name (unexpected);
|
argv[argc++] = yysymbol_name (unexpected);
|
||||||
@@ -2818,7 +2818,7 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
|
|||||||
for (int i = 0; i < nexpected; ++i)
|
for (int i = 0; i < nexpected; ++i)
|
||||||
argv[argc++] = yysymbol_name (expected[i]);
|
argv[argc++] = yysymbol_name (expected[i]);
|
||||||
}
|
}
|
||||||
syntax_error (*yyparse_context_location (ctx), argc, argv);
|
syntax_error (*yypcontext_location (ctx), argc, argv);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -799,7 +799,7 @@ epilogue.opt:
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yyparse_context_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
/* Arguments of format: reported tokens (one for the "unexpected",
|
/* Arguments of format: reported tokens (one for the "unexpected",
|
||||||
@@ -807,7 +807,7 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
|
|||||||
enum { ARGS_MAX = 5 };
|
enum { ARGS_MAX = 5 };
|
||||||
const char *argv[ARGS_MAX];
|
const char *argv[ARGS_MAX];
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
yysymbol_type_t unexpected = yyparse_context_token (ctx);
|
yysymbol_type_t unexpected = yypcontext_token (ctx);
|
||||||
if (unexpected != YYSYMBOL_YYEMPTY)
|
if (unexpected != YYSYMBOL_YYEMPTY)
|
||||||
{
|
{
|
||||||
argv[argc++] = yysymbol_name (unexpected);
|
argv[argc++] = yysymbol_name (unexpected);
|
||||||
@@ -819,7 +819,7 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
|
|||||||
for (int i = 0; i < nexpected; ++i)
|
for (int i = 0; i < nexpected; ++i)
|
||||||
argv[argc++] = yysymbol_name (expected[i]);
|
argv[argc++] = yysymbol_name (expected[i]);
|
||||||
}
|
}
|
||||||
syntax_error (*yyparse_context_location (ctx), argc, argv);
|
syntax_error (*yypcontext_location (ctx), argc, argv);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -622,18 +622,18 @@ location_print (FILE *yyo, ]AT_YYLTYPE[ const * const yylocp)
|
|||||||
|
|
||||||
]AT_ERROR_CUSTOM_IF([[
|
]AT_ERROR_CUSTOM_IF([[
|
||||||
int
|
int
|
||||||
yyreport_syntax_error (const yyparse_context_t *ctx]AT_PARAM_IF([, AT_PARSE_PARAMS])[)
|
yyreport_syntax_error (const yypcontext_t *ctx]AT_PARAM_IF([, AT_PARSE_PARAMS])[)
|
||||||
{
|
{
|
||||||
int res = 0;]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
|
int res = 0;]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
|
||||||
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [
|
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [
|
||||||
YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[
|
YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[
|
||||||
++global_nerrs;
|
++global_nerrs;
|
||||||
++*nerrs;]])[]AT_LOCATION_IF([[
|
++*nerrs;]])[]AT_LOCATION_IF([[
|
||||||
LOCATION_PRINT (stderr, *yyparse_context_location (ctx));
|
LOCATION_PRINT (stderr, *yypcontext_location (ctx));
|
||||||
fprintf (stderr, ": ");]])[
|
fprintf (stderr, ": ");]])[
|
||||||
fprintf (stderr, "syntax error");
|
fprintf (stderr, "syntax error");
|
||||||
{
|
{
|
||||||
yysymbol_type_t la = yyparse_context_token (ctx);
|
yysymbol_type_t la = yypcontext_token (ctx);
|
||||||
if (la != YYEMPTY)
|
if (la != YYEMPTY)
|
||||||
fprintf (stderr, " on token [%s]", yysymbol_name (la));
|
fprintf (stderr, " on token [%s]", yysymbol_name (la));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user