summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-05-17 21:00:55 -0400
committerAdrian Thurston <thurston@complang.org>2012-05-17 21:00:55 -0400
commit752e677f544295021971f2a871a33c68f0ea4dcc (patch)
tree52fc8d20ea7f8be351583da6b46f45645df91052
parent7ea2a24ea16d4a649d244c5e2eca3b3ba2e73736 (diff)
downloadcolm-752e677f544295021971f2a871a33c68f0ea4dcc.tar.gz
Call the detach of the right ignore.
-rw-r--r--colm/pdarun.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/colm/pdarun.c b/colm/pdarun.c
index 60e86f1f..4e09a3a3 100644
--- a/colm/pdarun.c
+++ b/colm/pdarun.c
@@ -670,7 +670,7 @@ static void attachIgnoreLeft( Program *prg, Tree **sp, PdaRun *pdaRun, ParseTree
}
/* Not currently used. Need to revive this. WARNING: untested changes here */
-void detachIgnoreRight( Program *prg, Tree **sp, PdaRun *pdaRun, FsmRun *fsmRun, ParseTree *parseTree )
+static void detachIgnoreRight( Program *prg, Tree **sp, PdaRun *pdaRun, ParseTree *parseTree )
{
/* Right ignore are immediately discarded since they are copies of
* left-ignores. */
@@ -1785,6 +1785,7 @@ again:
Kid *attrs;
Kid *dataLast, *dataChild;
+ /* If there was shift don't attach again. */
if ( !( *action & act_sb ) && pdaRun->lel->id < prg->rtd->firstNonTermId )
attachIgnoreRight( prg, sp, pdaRun, pdaRun->stackTop );
@@ -2084,6 +2085,10 @@ case PcrReverse:
treeDownref( prg, sp, pdaRun->undoLel->shadow->tree );
kidFree( prg, pdaRun->undoLel->shadow );
parseTreeFree( prg, pdaRun->undoLel );
+
+ /* If the stacktop had right ignore attached, detach now. */
+ if ( pdaRun->stackTop->flags & PF_RIGHT_IL_ATTACHED )
+ detachIgnoreRight( prg, sp, pdaRun, pdaRun->stackTop );
}
}
else if ( pdaRun->accumIgnore != 0 ) {
@@ -2150,6 +2155,10 @@ case PcrReverse:
pdaRun->undoLel->next = pdaRun->parseInput;
pdaRun->parseInput = pdaRun->undoLel;
}
+
+ /* Undo attach of right ignore. */
+ if ( pdaRun->stackTop->flags & PF_RIGHT_IL_ATTACHED )
+ detachIgnoreRight( prg, sp, pdaRun, pdaRun->stackTop );
}
}