[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: {maint} yacc.c: initialize yylval in pure-parser mode
From: |
Paul Eggert |
Subject: |
Re: {maint} yacc.c: initialize yylval in pure-parser mode |
Date: |
Fri, 21 Sep 2012 10:13:21 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 |
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"));]])[
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Akim Demaille, 2012/09/01
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Paul Eggert, 2012/09/01
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Akim Demaille, 2012/09/03
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Akim Demaille, 2012/09/19
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Paul Eggert, 2012/09/19
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Akim Demaille, 2012/09/21
- Re: {maint} yacc.c: initialize yylval in pure-parser mode,
Paul Eggert <=
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Akim Demaille, 2012/09/27
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Paul Eggert, 2012/09/27
- Re: {maint} yacc.c: initialize yylval in pure-parser mode, Akim Demaille, 2012/09/28