* data/glr.c (yyresolveValue): Fix redundant parse tree problem

reported by Joel E. Denny in
<http://lists.gnu.org/archive/html/bison-patches/2005-08/msg00004.html>
(trivial change).
* tests/glr-regression.at (Duplicate representation of merged trees):
New test, from Joel E. Denny in:
<http://lists.gnu.org/archive/html/help-bison/2005-07/msg00013.html>.
* THANKS: Add Joel E. Denny.
This commit is contained in:
Paul Eggert
2005-08-21 23:43:56 +00:00
parent 1fb38e78c2
commit f9315de5a4
4 changed files with 134 additions and 18 deletions

View File

@@ -1606,35 +1606,44 @@ yyresolveValue (yySemanticOption* yyoptionList, yyGLRStack* yystack,
YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
{
yySemanticOption* yybest;
yySemanticOption* yyp;
yySemanticOption** yypp;
yybool yymerge;
yybest = yyoptionList;
yymerge = yyfalse;
for (yyp = yyoptionList->yynext; yyp != NULL; yyp = yyp->yynext)
for (yypp = &yyoptionList->yynext; *yypp != NULL; )
{
yySemanticOption* yyp = *yypp;
if (yyidenticalOptions (yybest, yyp))
yymergeOptionSets (yybest, yyp);
{
yymergeOptionSets (yybest, yyp);
*yypp = yyp->yynext;
}
else
switch (yypreference (yybest, yyp))
{
case 0:
yyreportAmbiguity (yybest, yyp, yystack]b4_pure_args[);
break;
case 1:
yymerge = yytrue;
break;
case 2:
break;
case 3:
yybest = yyp;
yymerge = yyfalse;
break;
}
{
switch (yypreference (yybest, yyp))
{
case 0:
yyreportAmbiguity (yybest, yyp, yystack]b4_pure_args[);
break;
case 1:
yymerge = yytrue;
break;
case 2:
break;
case 3:
yybest = yyp;
yymerge = yyfalse;
break;
}
yypp = &yyp->yynext;
}
}
if (yymerge)
{
yySemanticOption* yyp;
int yyprec = yydprec[yybest->yyrule];
YYCHK (yyresolveAction (yybest, yystack, yyvalp, yylocp]b4_user_args[));
for (yyp = yybest->yynext; yyp != NULL; yyp = yyp->yynext)