[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glr & locations

From: Joel E. Denny
Subject: Re: glr & locations
Date: Sat, 29 Oct 2005 01:18:50 -0400 (EDT)

On Fri, 28 Oct 2005, Paul Hilfinger wrote:

YYLLOC_DEFAULT is supposed to copy the location for an empty non-terminal
from the location of the previous symbol, but the current implementation
loses that location during a split GLR parse.

The following patch works for me, and passes make check. However, I
haven't really had time to properly test it.


@@ -1290,7 +1289,10 @@ yydoAction (yyGLRStack* yystack, size_t
      yyGLRState* yys;
      yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
      yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
-       = yystack->yytops.yystates[yyk];
+       = yystack->yytops.yystates[yyk];]b4_location_if([[
+      if (yynrhs == 0)
+       /* Set default location. */
+        yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[
      for (yyi = 0; yyi < yynrhs; yyi += 1)
          yys = yys->yypred;

This code appears inside the else block within yydoAction(). Is it really possible for the else block to ever execute? It seems to me that yydoAction() is only called during deterministic operation, but the else block is for a split stack. I added a print to that else block, ran the test suite and a few of my own programs, and could never get the print to execute.

Perhaps a better question is, within yyglrReduce(), is it ever true that yyforceEval && yystack->yysplitPoint != NULL?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]