mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
* data/glr.c (yyresolveLocations): Remove bogus YYASSERT that the
state before an empty RHS is always resolved here. Only the location of that state is guaranteed to be resolved, and that's enough. This fixes the remaining bug reported by Derek M. Jones in <http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00027.html>. * tests/glr-regression.at (Uninitialized location when reporting ambiguity): Test the above case. Also, the embedded comments in this test case claim it checks the case of an empty RHS that has inherited the initial location. However, the corresponding LHS was already resolved, so yyresolveLocations didn't actually have reason to modify it. Fix this by forcing nondeterministic operation at the beginning of the parse.
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,3 +1,18 @@
|
|||||||
|
2006-05-21 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
|
* data/glr.c (yyresolveLocations): Remove bogus YYASSERT that the
|
||||||
|
state before an empty RHS is always resolved here. Only the location
|
||||||
|
of that state is guaranteed to be resolved, and that's enough. This
|
||||||
|
fixes the remaining bug reported by Derek M. Jones in
|
||||||
|
<http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00027.html>.
|
||||||
|
* tests/glr-regression.at (Uninitialized location when reporting
|
||||||
|
ambiguity): Test the above case.
|
||||||
|
Also, the embedded comments in this test case claim it checks the case
|
||||||
|
of an empty RHS that has inherited the initial location. However, the
|
||||||
|
corresponding LHS was already resolved, so yyresolveLocations didn't
|
||||||
|
actually have reason to modify it. Fix this by forcing
|
||||||
|
nondeterministic operation at the beginning of the parse.
|
||||||
|
|
||||||
2006-05-20 Paul Eggert <eggert@cs.ucla.edu>
|
2006-05-20 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
* data/c.m4 (b4_yy_symbol_print_generate):
|
* data/c.m4 (b4_yy_symbol_print_generate):
|
||||||
|
|||||||
10
data/glr.c
10
data/glr.c
@@ -201,7 +201,7 @@ typedef struct YYLTYPE
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
b4_defines_if([#include @output_header_name@],
|
b4_defines_if([#include @output_header_name@],
|
||||||
[b4_shared_declarations])[
|
[b4_shared_declarations])[
|
||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
@@ -1836,8 +1836,14 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Both yyresolveAction and yyresolveLocations traverse the GSS
|
||||||
|
in reverse rightmost order. It is only necessary to invoke
|
||||||
|
yyresolveLocations on a subforest for which yyresolveAction
|
||||||
|
would have been invoked next had an ambiguity not been
|
||||||
|
detected. Thus the location of the previous state (but not
|
||||||
|
necessarily the previous state itself) is guaranteed to be
|
||||||
|
resolved already. */
|
||||||
yyGLRState *yyprevious = yyoption->yystate;
|
yyGLRState *yyprevious = yyoption->yystate;
|
||||||
YYASSERT (yyprevious->yyresolved);
|
|
||||||
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
||||||
}
|
}
|
||||||
yychar_current = yychar;
|
yychar_current = yychar;
|
||||||
|
|||||||
@@ -1606,17 +1606,22 @@ AT_DATA_GRAMMAR([glr-regr17.y],
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
/* Tests the case of an empty RHS that has inherited the location of the
|
||||||
|
previous nonterminal, which is unresolved. That location is reported as the
|
||||||
|
last position of the ambiguity. */
|
||||||
|
start: ambig1 empty1 | ambig2 empty2 ;
|
||||||
|
|
||||||
/* Tests multiple levels of yyresolveLocations recursion. */
|
/* Tests multiple levels of yyresolveLocations recursion. */
|
||||||
start: ambig1 | ambig2 ;
|
|
||||||
ambig1: sub_ambig1 | sub_ambig2 ;
|
ambig1: sub_ambig1 | sub_ambig2 ;
|
||||||
ambig2: sub_ambig1 | sub_ambig2 ;
|
ambig2: sub_ambig1 | sub_ambig2 ;
|
||||||
|
|
||||||
/* Tests non-empty RHS as well as empty RHS with either initial location or
|
/* Tests the case of a non-empty RHS as well as the case of an empty RHS that
|
||||||
location of previous token. Both empty RHS locations are printed in the
|
has inherited the initial location. The empty RHS's location is reported as
|
||||||
error message. */
|
the first position in the ambiguity. */
|
||||||
sub_ambig1: empty 'a' 'b' empty ;
|
sub_ambig1: empty1 'a' 'b' ;
|
||||||
sub_ambig2: empty 'a' 'b' empty ;
|
sub_ambig2: empty2 'a' 'b' ;
|
||||||
empty: ;
|
empty1: ;
|
||||||
|
empty2: ;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user