Fix some errors that were causing testsuite failures for GLR.

* data/glr.c (yy_reduce_print): Change yyrhsVals to yyvsp to remove
	compiler errors when using %debug.
	Add declaration of yylow when locations in use to avoid compilation
	error.
	(yyglrReduce): Conditionalize message "Parse ... rejected by rule..."
	on whether we are in split mode, for consistency with behavior of
	non-GLR parsing.
This commit is contained in:
Paul Hilfinger
2010-09-08 00:52:05 -07:00
parent c49784f5f5
commit d467f443df
2 changed files with 18 additions and 7 deletions

View File

@@ -1,3 +1,13 @@
2010-09-08 Paul Hilfinger <hilfinger@cs.berkeley.edu>
* data/glr.c (yy_reduce_print): Change yyrhsVals to yyvsp to remove
compiler errors when using %debug.
Add declaration of yylow when locations in use to avoid compilation
error.
(yyglrReduce): Conditionalize message "Parse ... rejected by rule..."
on whether we are in split mode, for consistency with behavior of
non-GLR parsing.
2010-09-01 Akim Demaille <demaille@gostai.com> 2010-09-01 Akim Demaille <demaille@gostai.com>
Address GCC warnings about shadowed local variables (yyflag). Address GCC warnings about shadowed local variables (yyflag).

View File

@@ -1325,26 +1325,27 @@ do { \
`----------------------------------------------------------------------*/ `----------------------------------------------------------------------*/
/*ARGSUSED*/ static inline void /*ARGSUSED*/ static inline void
yy_reduce_print (int yynormal, yyGLRStackItem* yyrhsVals, size_t yyk, yyRuleNum yyrule]b4_user_formals[) yy_reduce_print (int yynormal, yyGLRStackItem* yyvsp, size_t yyk, yyRuleNum yyrule]b4_user_formals[)
{ {
int yynrhs = yyrhsLength (yyrule); int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
int yylow = 1;])[
int yyi; int yyi;
]b4_parse_param_use[]dnl ]b4_parse_param_use[]dnl
[ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n", [ YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
(unsigned long int) yyk, yyrule - 1, (unsigned long int) yyk, yyrule - 1,
(unsigned long int) yyrline[yyrule]); (unsigned long int) yyrline[yyrule]);
if (! yynormal) if (! yynormal)
yyfillin (yyrhsVals, 1, -yynrhs); yyfillin (yyvsp, 1, -yynrhs);
/* The symbols being reduced. */ /* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) for (yyi = 0; yyi < yynrhs; yyi++)
{ {
YYFPRINTF (stderr, " $%d = ", yyi + 1); YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yy_symbol_print (stderr,
yystos[yyrhsVals[yyi - yynrhs + 1].yystate.yylrState], yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState],
&yyrhsVals[yyi - yynrhs + 1].yystate.yysemantics.yysval &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
b4_user_args[); b4_user_args[);
if (!yyrhsVals[yyi - yynrhs + 1].yystate.yyresolved) if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
YYFPRINTF (stderr, " (unresolved)"); YYFPRINTF (stderr, " (unresolved)");
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
@@ -1423,7 +1424,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
yyflag = yydoAction (yystackp, yyk, yyrule, &yysval, yyflag = yydoAction (yystackp, yyk, yyrule, &yysval,
&yyloc]b4_user_args[); &yyloc]b4_user_args[);
if (yyflag == yyerr) if (yyflag == yyerr && yystackp->yysplitPoint != NULL)
{ {
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n", YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
(unsigned long int) yyk, yyrule - 1)); (unsigned long int) yyk, yyrule - 1));