diff options
-rw-r--r-- | colm/fsmrun.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/colm/fsmrun.cpp b/colm/fsmrun.cpp index 0f864ae2..3280242b 100644 --- a/colm/fsmrun.cpp +++ b/colm/fsmrun.cpp @@ -606,10 +606,6 @@ void exec_gen( FsmRun *fsmRun, PdaRun *parser, long id ) } #endif - LangElInfo *lelInfo = parser->tables->rtd->lelInfo; - if ( lelInfo[id].markId >= 0 ) - fsmRun->p = fsmRun->mark[lelInfo[id].markId]; - /* Make the token data. */ long length = fsmRun->p - fsmRun->tokstart; Head *tokdata = string_alloc_const( fsmRun->prg, fsmRun->tokstart, length ); @@ -630,10 +626,6 @@ void send_ignore( FsmRun *fsmRun, PdaRun *parser, long id ) } #endif - LangElInfo *lelInfo = parser->tables->rtd->lelInfo; - if ( lelInfo[id].markId >= 0 ) - fsmRun->p = fsmRun->mark[lelInfo[id].markId]; - /* Make the ignore string. */ int length = fsmRun->p - fsmRun->tokstart; Head *ignoreStr = string_alloc_const( fsmRun->prg, fsmRun->tokstart, length ); @@ -656,10 +648,6 @@ void send_token( FsmRun *fsmRun, PdaRun *parser, long id ) } #endif - LangElInfo *lelInfo = parser->tables->rtd->lelInfo; - if ( lelInfo[id].markId >= 0 ) - fsmRun->p = fsmRun->mark[lelInfo[id].markId]; - /* Make the token data. */ long length = fsmRun->p - fsmRun->tokstart; Head *tokdata = string_alloc_const( fsmRun->prg, fsmRun->tokstart, length ); @@ -904,8 +892,15 @@ long FsmRun::scanToken( PdaRun *parser ) execute(); /* First check if scanning stopped because we have a token. */ - if ( matchedToken > 0 ) + if ( matchedToken > 0 ) { + /* If the token has a marker indicating the end (due to trailing + * context) then adjust p now. */ + LangElInfo *lelInfo = parser->tables->rtd->lelInfo; + if ( lelInfo[matchedToken].markId >= 0 ) + p = mark[lelInfo[matchedToken].markId]; + return matchedToken; + } /* Check for error. */ if ( cs == tables->errorState ) { |