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;