glr.c, yacc.c: propagate yysymbol_type_t

Now that yacc.c and glr.c both know yysymbol_type_t, convert the
common routines.

* data/skeletons/c.m4 (yydestruct, yy_symbol_value_print)
(yy_symbol_print): Use yysymbol_type_t instead of int.
* data/skeletons/glr.c: Use yySymbol where appropriate.
* data/skeletons/yacc.c (YY_ACCESSING_SYMBOL): New wrapper around
yystos.
Use it.
* tests/local.at (yyreport_syntax_error): Use yysymbol_type_t where
appropriate.
This commit is contained in:
Akim Demaille
2020-03-29 11:51:31 +02:00
parent 39792f57fb
commit 086506bf23
4 changed files with 16 additions and 13 deletions

View File

@@ -633,13 +633,13 @@ yyreport_syntax_error (const yyparse_context_t *ctx]AT_PARAM_IF([, AT_PARSE_PARA
fprintf (stderr, ": ");]])[
fprintf (stderr, "syntax error");
{
int la = yyparse_context_token (ctx);
yysymbol_type_t la = yyparse_context_token (ctx);
if (la != YYEMPTY)
fprintf (stderr, " on token [%s]", yysymbol_name (la));
}
{
enum { TOKENMAX = 10 };
int expected[TOKENMAX];
yysymbol_type_t expected[TOKENMAX];
int n = yyexpected_tokens (ctx, expected, TOKENMAX);
/* Forward errors to yyparse. */
if (n < 0)