[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/7] glr: more assertions
From: |
Akim Demaille |
Subject: |
[PATCH 7/7] glr: more assertions |
Date: |
Thu, 19 Sep 2013 16:26:07 +0200 |
* data/glr.c (yyaddDeferredAction, yyglrShiftDefer, yypdumpstack):
More assertions.
---
data/glr.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/data/glr.c b/data/glr.c
index e30653c..8ef3553 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),
--
1.8.4
- [PATCH 0/7] {maint} minor issues, Akim Demaille, 2013/09/19
- [PATCH 1/7] tests: remove stray debugging traces, Akim Demaille, 2013/09/19
- [PATCH 3/7] examples: improve the output of the "variant" example, Akim Demaille, 2013/09/19
- [PATCH 4/7] glr: better use of tracing macros, Akim Demaille, 2013/09/19
- [PATCH 6/7] glr: shorten scopes, Akim Demaille, 2013/09/19
- [PATCH 2/7] variant: remove useless assertion, Akim Demaille, 2013/09/19
- [PATCH 7/7] glr: more assertions,
Akim Demaille <=
- [PATCH 5/7] glr: formatting changes, Akim Demaille, 2013/09/19