<http://mail.gnu.org/pipermail/bug-bison/2002-November/001815.html>.
* data/glr.c (yyis_pact_ninf, yyis_table_ninf): New macros, which
evalutate to 0 if it's impossible for NINF to be in the respective
table.
(yygetLRActions, yyrecoverParseError): Use them.
+#define yyis_pact_ninf(yystate) \
+ ]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), 1,
+ 0,
+ ((yystate) == YYPACT_NINF))[
+
/** True iff LR state STATE has only a default reduction (regardless
* of token). */
static inline bool
yyisDefaultedState (yyStateNum yystate)
{
/** True iff LR state STATE has only a default reduction (regardless
* of token). */
static inline bool
yyisDefaultedState (yyStateNum yystate)
{
- return yypact[yystate] == YYPACT_NINF;
+ return yyis_pact_ninf (yypact[yystate]);
}
/** The default reduction for STATE, assuming it has one. */
}
/** The default reduction for STATE, assuming it has one. */
return yydefact[yystate];
}
return yydefact[yystate];
}
+#define yyis_table_ninf(yyindex) \
+ ]m4_if(m4_eval(b4_table_ninf < b4_table_min), 1,
+ 0,
+ ((yyindex) == YYTABLE_NINF))[
+
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
* Result R means
* R < 0: Reduce on rule -R.
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
* Result R means
* R < 0: Reduce on rule -R.
*yyaction = -yydefact[yystate];
*yyconflicts = yyconfl;
}
*yyaction = -yydefact[yystate];
*yyconflicts = yyconfl;
}
- else if (yytable[yyindex] != YYTABLE_NINF)
+ else if (! yyis_table_ninf (yyindex))
{
*yyaction = yytable[yyindex];
*yyconflicts = yyconfl + yyconflp[yyindex];
{
*yyaction = yytable[yyindex];
*yyconflicts = yyconfl + yyconflp[yyindex];
*yytokenp = YYTRANSLATE (yychar);
YYDPRINTF ((stderr, "Next token is %s\n", yytokenName (*yytokenp)));
yyj = yypact[yystack->yytops.yystates[0]->yylrState];
*yytokenp = YYTRANSLATE (yychar);
YYDPRINTF ((stderr, "Next token is %s\n", yytokenName (*yytokenp)));
yyj = yypact[yystack->yytops.yystates[0]->yylrState];
- if (yyj == YYPACT_NINF)
+ if (yyis_pact_ninf (yyj))
/* Something's not right; we shouldn't be here. */
yyFail (yystack][]b4_lpure_args[, NULL);
yyj += *yytokenp;
/* Something's not right; we shouldn't be here. */
yyFail (yystack][]b4_lpure_args[, NULL);
yyj += *yytokenp;
if (yydefact[yystack->yytops.yystates[0]->yylrState] != 0)
return;
}
if (yydefact[yystack->yytops.yystates[0]->yylrState] != 0)
return;
}
- else if (yytable[yyj] != 0 && yytable[yyj] != YYTABLE_NINF)
+ else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj]))
/* Now pop stack until we find a state that shifts the error token. */
while (yystack->yytops.yystates[0] != NULL)
{
/* Now pop stack until we find a state that shifts the error token. */
while (yystack->yytops.yystates[0] != NULL)
{
- yyj = yypact[yystack->yytops.yystates[0]->yylrState] + YYTERROR;
- if (yyj != YYPACT_NINF + YYTERROR && yyj >= 0 && yyj <= YYLAST &&
- yycheck[yyj] == YYTERROR && yyisShiftAction (yytable[yyj]))
+ yyj = yypact[yystack->yytops.yystates[0]->yylrState];
+ if (! yyis_pact_ninf (yyj))
- yyglrShift (yystack, 0, yytable[yyj],
- yystack->yytops.yystates[0]->yyposn,
- *yylvalp, yyllocp]b4_user_args[);
- break;
+ yyj += YYTERROR;
+ if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
+ && yyisShiftAction (yytable[yyj]))
+ {
+ yyglrShift (yystack, 0, yytable[yyj],
+ yystack->yytops.yystates[0]->yyposn,
+ *yylvalp, yyllocp]b4_user_args[);
+ break;
+ }
}
yystack->yytops.yystates[0] = yystack->yytops.yystates[0]->yypred;
yystack->yynextFree -= 1;
}
yystack->yytops.yystates[0] = yystack->yytops.yystates[0]->yypred;
yystack->yynextFree -= 1;