* tests/regression.at (input.y): s/YYEOF/MYEOF/, as the skeleton

defines it.
* data/glr.c (yystos): New.
(b4_yysymprint_generate, b4_yydestruct_generate): Invoke.
(YYDSYMPRINT): New.
(yyval): Don't define it, it is handled via M4.
(yyrecoverParseError): Free verbosely the discarded symbols.
* data/yacc.c (yysymprint): Remove, rather...
(b4_yysymprint_generate): invoke.
* data/c.m4 (b4_yysymprint_generate): New.
Accept pointers as arguments, as opposed to the version from
yacc.c.
(b4_yydestruct_generate): Likewise.
* tests/cations.at (Printers and Destructors): Use Bison directives
instead of CPP macros.
Don't rely on internal details.
This commit is contained in:
Akim Demaille
2002-11-12 09:03:13 +00:00
parent b0400cc6ef
commit 7bd6c77e5e
7 changed files with 156 additions and 77 deletions

View File

@@ -620,42 +620,8 @@ yystpcpy (yydest, yysrc)
#if YYDEBUG
/*-----------------------------.
| Print this symbol on YYOUT. |
`-----------------------------*/
b4_c_function_def([yysymprint],
[static void],
[[FILE *yyout], [yyout]],
[[int yytype], [yytype]],
[[YYSTYPE yyvalue], [yyvalue]]b4_location_if([,
[[YYLTYPE yylocation], [yylocation]]]))
{
/* Pacify ``unused variable'' warnings. */
(void) yyvalue;
b4_location_if([ (void) yylocation;
])dnl
if (yytype < YYNTOKENS)
{
YYFPRINTF (yyout, "token %s (", yytname[[yytype]]);
# ifdef YYPRINT
YYPRINT (yyout, yytoknum[[yytype]], yyvalue);
# endif
}
else
YYFPRINTF (yyout, "nterm %s (", yytname[[yytype]]);
switch (yytype)
{
m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
default:
break;
}
YYFPRINTF (yyout, ")");
}
b4_yysymprint_generate([b4_c_function_def])
#endif /* YYDEBUG. */
b4_yydestruct_generate([b4_c_function_def])
@@ -888,7 +854,7 @@ yybackup:
/* We have to keep this `#if YYDEBUG', since we use variables
which are defined only if `YYDEBUG' is set. */
YYDPRINTF ((stderr, "Next token is "));
YYDSYMPRINT ((stderr, yytoken, yylval]b4_location_if([, yyloc])[));
YYDSYMPRINT ((stderr, yytoken, &yylval]b4_location_if([, &yyloc])[));
YYDPRINTF ((stderr, "\n"));
}
@@ -1097,9 +1063,9 @@ yyerrlab1:
YYDPRINTF ((stderr, "Error: popping "));
YYDSYMPRINT ((stderr,
yystos[*yyssp],
*yyvsp]b4_location_if([, *yylsp])[));
yyvsp]b4_location_if([, yylsp])[));
YYDPRINTF ((stderr, "\n"));
yydestruct (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[);
yydestruct (yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
YYPOPSTACK;
}
YYABORT;
@@ -1107,7 +1073,7 @@ yyerrlab1:
YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
yytoken, yytname[yytoken]));
yydestruct (yytoken, yylval]b4_location_if([, yylloc])[);
yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);
yytoken = YYEMPTY;
}
@@ -1136,10 +1102,10 @@ yyerrlab1:
YYDPRINTF ((stderr, "Error: popping "));
YYDSYMPRINT ((stderr,
yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[));
yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[));
YYDPRINTF ((stderr, "\n"));
yydestruct (yystos[yystate], *yyvsp]b4_location_if([, *yylsp])[);
yydestruct (yystos[yystate], yyvsp]b4_location_if([, yylsp])[);
yyvsp--;
yystate = *--yyssp;
]b4_location_if([ yylsp--;])[