From d6699fe744b583a7cce1567935dc6979c1cb035a Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 20 Nov 2011 22:34:44 +0000 Subject: Put the setting of the region into a function call. --- colm/fsmrun.c | 22 ++++++++++++---------- 1 file 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 ) { -- cgit v1.2.1