summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2013-09-19 15:27:19 +0200
committerAkim Demaille <akim@lrde.epita.fr>2013-09-19 15:58:00 +0200
commit77482f2783538f8b5f19970e36a1ace6a93441b3 (patch)
tree310bc1e75b91af9c23b6d220adf3f539afc8bae4
parent5a6e85fb8d223b0decb8fdc10465daf00d2cdf66 (diff)
downloadbison-77482f2783538f8b5f19970e36a1ace6a93441b3.tar.gz
glr: more assertions
* data/glr.c (yyaddDeferredAction, yyglrShiftDefer, yypdumpstack): More assertions.
-rw-r--r--data/glr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/data/glr.c b/data/glr.c
index e30653cc..8ef35534 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -964,6 +964,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
{
yySemanticOption* yynewOption =
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
+ YYASSERT (!yynewOption->yyisState);
yynewOption->yystate = yyrhs;
yynewOption->yyrule = yyrule;
if (yystackp->yytops.yylookaheadNeeds[yyk])
@@ -1199,6 +1200,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
{
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
+ YYASSERT (yynewState->yyisState);
yynewState->yylrState = yylrState;
yynewState->yyposn = yyposn;
@@ -2501,6 +2503,8 @@ yypdumpstack (yyGLRStack* yystackp)
(unsigned long int) (yyp - yystackp->yyitems));
if (*(yybool *) yyp)
{
+ YYASSERT (yyp->yystate.yyisState);
+ YYASSERT (yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
yyp->yystate.yyresolved, yyp->yystate.yylrState,
(unsigned long int) yyp->yystate.yyposn,
@@ -2512,6 +2516,8 @@ yypdumpstack (yyGLRStack* yystackp)
}
else
{
+ YYASSERT (!yyp->yystate.yyisState);
+ YYASSERT (!yyp->yyoption.yyisState);
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
yyp->yyoption.yyrule - 1,
(long int) YYINDEX (yyp->yyoption.yystate),