summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2011-11-20 22:34:44 +0000
committerAdrian Thurston <thurston@complang.org>2011-11-20 22:34:44 +0000
commitd6699fe744b583a7cce1567935dc6979c1cb035a (patch)
treedf94e8751bf77bc331bf0044a98d1a9706bfe81a
parent68e669e01e5505492ab0ddb0f78d70981eb6fdb8 (diff)
downloadcolm-d6699fe744b583a7cce1567935dc6979c1cb035a.tar.gz
Put the setting of the region into a function call.
-rw-r--r--colm/fsmrun.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/colm/fsmrun.c b/colm/fsmrun.c
index 6904224f..613e83d6 100644
--- a/colm/fsmrun.c
+++ b/colm/fsmrun.c
@@ -489,7 +489,7 @@ break; }
return PcrDone;
}
-void ignoreTree( Program *prg, PdaRun *pdaRun, Tree *tree )
+void setRegion( PdaRun *pdaRun, Tree *tree )
{
if ( pdaRun->accumIgnore == 0 ) {
/* Recording the next region. */
@@ -497,6 +497,11 @@ void ignoreTree( Program *prg, PdaRun *pdaRun, Tree *tree )
if ( pdaRun->tables->tokenRegions[pt(tree)->region+1] != 0 )
pdaRun->numRetry += 1;
}
+}
+
+void ignoreTree( Program *prg, PdaRun *pdaRun, Tree *tree )
+{
+ setRegion( pdaRun, tree );
/* Add the ignore string to the head of the ignore list. */
Kid *ignore = kidAllocate( prg );
@@ -790,6 +795,10 @@ Kid *sendToken( Program *prg, Tree **sp, InputStream *inputStream, FsmRun *fsmRu
incrementConsumed( pdaRun );
+ /* Store any alternate scanning region. */
+ if ( input != 0 && pdaRun->cs >= 0 )
+ setRegion( pdaRun, input->tree );
+
return input;
}
@@ -1166,7 +1175,7 @@ return PcrGeneration;
case PcrGeneration:
/*
- * Need a no-token.
+ * May need a no-token.
*/
addNoToken( prg, sp, fsmRun, pdaRun, inputStream,
prg->rtd->lelInfo[pdaRun->tokenId].frameId, pdaRun->tokenId, pdaRun->tokdata );
@@ -1190,17 +1199,10 @@ case PcrGeneration:
/* Is a plain token. */
pdaRun->input1 = sendToken( prg, sp, inputStream, fsmRun, pdaRun, pdaRun->tokenId );
- }
- if ( pdaRun->input1 != 0 && pdaRun->cs >= 0 ) {
- if ( pdaRun->accumIgnore == 0 ) {
- /* Recording the next region. */
- pt(pdaRun->input1->tree)->region = pdaRun->nextRegionInd;
- if ( pdaRun->tables->tokenRegions[pt(pdaRun->input1->tree)->region+1] != 0 )
- pdaRun->numRetry += 1;
- }
}
+
long pcr = parseToken( prg, sp, pdaRun, fsmRun, inputStream, PcrStart );
while ( pcr != PcrDone ) {