On 09/21/2012 01:43 AM, Akim Demaille wrote:
> The idea is nice, but there are several issues.
OK, how about the following patch to the trunk?
It attempts to address the issues you mentioned.
diff --git a/data/yacc.c b/data/yacc.c
index a15ef77..f498867 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -1469,7 +1469,21 @@ m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
]])dnl
m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
]])])dnl
-[ goto yysetstate;
+[ if (yychar != YYEMPTY || yyss + yystacksize - 1 <= yyssp)
+ goto yysetstate;
+
+ *yyssp = yystate;
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
+ yyn = yypact[yystate];
+ if (yypact_value_is_default (yyn))
+ goto yydefault;
+
+ goto yyread_token;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
@@ -1572,7 +1586,8 @@ yybackup:
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
- {]b4_push_if([[
+ {
+yyread_token:]b4_push_if([[
if (!yyps->yynew)
{]b4_use_push_for_pull_if([], [[
YYDPRINTF ((stderr, "Return for a new token:\n"));]])[