diff --git a/TODO b/TODO index e417fdb3..f314682a 100644 --- a/TODO +++ b/TODO @@ -53,22 +53,6 @@ would actually also make the following point gracefully handled (status of YYERRCODE, YYUNDEFTOK, etc.). Possibly we could also define YYEMPTY (twice: as a token and as a symbol). And YYEOF. -It seems to work well. Yet we have a weird case: the "error" token: - -enum yysymbol_type_t -{ - YYSYMBOL_YYEMPTY = -2, - YYSYMBOL_YYEOF = 0, - YYSYMBOL_error = 1, - YYSYMBOL_YYUNDEF = 2, - YYSYMBOL_YYACCEPT = 61, - ... - -YYSYMBOL_error looks weird. We should maybe rename this as -"YYSYMBOL_YYERROR", even though it should not be confonded with the YYERROR -macro. - - ** Consistency YYUNDEFTOK is an internal symbol number, as YYTERROR. But YYERRCODE is an external token number. diff --git a/data/skeletons/bison.m4 b/data/skeletons/bison.m4 index 20de1b7e..d54ea2b7 100644 --- a/data/skeletons/bison.m4 +++ b/data/skeletons/bison.m4 @@ -413,9 +413,10 @@ m4_define([b4_symbol_sid], [m4_case([$1], [-2], [[YYSYMBOL_YYEMPTY]], [0], [[YYSYMBOL_YYEOF]], - [m4_bmatch(m4_quote(b4_symbol([$1], [tag])), - [^\$accept$], [[YYSYMBOL_YYACCEPT]], - [^\$undefined$], [[YYSYMBOL_YYUNDEF]], + [m4_case(m4_quote(b4_symbol([$1], [tag])), + [$accept], [[YYSYMBOL_YYACCEPT]], + [error], [[YYSYMBOL_YYERROR]], + [$undefined], [[YYSYMBOL_YYUNDEF]], [m4_quote(b4_symbol_if([$1], [has_id], [[YYSYMBOL_]]m4_quote(_b4_symbol([$1], [id]))))])])]) diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index 5c5a3964..d9ded757 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -1147,7 +1147,7 @@ yyexpected_tokens (const yyparse_context_t *yyctx, ]b4_lac_if([[ int yyx; for (yyx = 0; yyx < YYNTOKENS; ++yyx) - if (yyx != YYSYMBOL_error && yyx != YYSYMBOL_YYUNDEF) + if (yyx != YYSYMBOL_YYERROR && yyx != YYSYMBOL_YYUNDEF) switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yyx]], [[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yyx]])[)) { @@ -1175,7 +1175,7 @@ yyexpected_tokens (const yyparse_context_t *yyctx, int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_error + if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (!yyarg) @@ -1998,8 +1998,8 @@ yyerrlab1: yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYSYMBOL_error; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_error) + yyn += YYSYMBOL_YYERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYERROR) { yyn = yytable[yyn]; if (0 < yyn)