diff options
author | Adrian Thurston <thurston@complang.org> | 2009-03-06 03:27:00 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2009-03-06 03:27:00 +0000 |
commit | 99bad941034ba014cdae7eae6ddd3f11121c67ae (patch) | |
tree | 91a14f4aa37284df895d4127e6cb50a98558b120 | |
parent | 52ce97b96de8b40736a9e36682f313d486b2d19c (diff) | |
download | colm-99bad941034ba014cdae7eae6ddd3f11121c67ae.tar.gz |
Branch for implementing the pull scanner.
-rw-r--r-- | fsmcodegen.cpp | 8 | ||||
-rw-r--r-- | fsmexec.cpp | 22 | ||||
-rw-r--r-- | fsmrun.h | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/fsmcodegen.cpp b/fsmcodegen.cpp index fe5a6fb3..0f5b1960 100644 --- a/fsmcodegen.cpp +++ b/fsmcodegen.cpp @@ -231,7 +231,7 @@ void FsmCodeGen::LM_SWITCH( ostream &ret, InlineItem *item, ret << " }\n" "\t" - " goto _resume;\n"; + " return;\n"; } void FsmCodeGen::LM_ON_LAST( ostream &ret, InlineItem *item ) @@ -240,7 +240,7 @@ void FsmCodeGen::LM_ON_LAST( ostream &ret, InlineItem *item ) ret << " " << P() << " += 1;\n"; EMIT_TOKEN( ret, item->longestMatchPart->token ); - ret << " goto _resume;\n"; + ret << " return;\n"; } void FsmCodeGen::LM_ON_NEXT( ostream &ret, InlineItem *item ) @@ -248,7 +248,7 @@ void FsmCodeGen::LM_ON_NEXT( ostream &ret, InlineItem *item ) assert( item->longestMatchPart->token != 0 ); EMIT_TOKEN( ret, item->longestMatchPart->token ); - ret << " goto _resume;\n"; + ret << " return;\n"; } void FsmCodeGen::LM_ON_LAG_BEHIND( ostream &ret, InlineItem *item ) @@ -257,7 +257,7 @@ void FsmCodeGen::LM_ON_LAG_BEHIND( ostream &ret, InlineItem *item ) ret << " " << P() << " = " << TOKEND() << ";\n"; EMIT_TOKEN( ret, item->longestMatchPart->token ); - ret << " goto _resume;\n"; + ret << " return;\n"; } diff --git a/fsmexec.cpp b/fsmexec.cpp index 8f5d7600..d08158b3 100644 --- a/fsmexec.cpp +++ b/fsmexec.cpp @@ -68,21 +68,21 @@ void FsmRun::execAction( GenAction *genAction ) emitToken( lmi->token ); } } - gotoResume = true; + returnResult = true; break; case InlineItem::LmOnLast: p += 1; emitToken( item->longestMatchPart->token ); - gotoResume = true; + returnResult = true; break; case InlineItem::LmOnNext: emitToken( item->longestMatchPart->token ); - gotoResume = true; + returnResult = true; break; case InlineItem::LmOnLagBehind: p = tokend; emitToken( item->longestMatchPart->token ); - gotoResume = true; + returnResult = true; break; } } @@ -99,7 +99,7 @@ void FsmRun::execute() unsigned int _nacts; const char *_keys; -_resume: +//_resume: if ( cs == tables->errorState ) goto out; @@ -166,13 +166,13 @@ _match: if ( tables->transActionsWI[_trans] == 0 ) goto _again; - gotoResume = false; + returnResult = false; _acts = tables->actions + tables->transActionsWI[_trans]; _nacts = (unsigned int) *_acts++; while ( _nacts-- > 0 ) execAction( tables->actionSwitch[*_acts++] ); - if ( gotoResume ) - goto _resume; + if ( returnResult ) + return; _again: _acts = tables->actions + tables->toStateActions[cs]; @@ -187,7 +187,7 @@ _again: goto _loop_head; out: if ( p == peof ) { - gotoResume = false; + returnResult = false; _acts = tables->actions + tables->eofActions[cs]; _nacts = (unsigned int) *_acts++; @@ -196,8 +196,8 @@ out: while ( _nacts-- > 0 ) execAction( tables->actionSwitch[*_acts++] ); - if ( gotoResume ) - goto _resume; + if ( returnResult ) + return; } } @@ -123,7 +123,7 @@ struct FsmRun char *p, *pe, *peof; bool eofSent; RunBuf *runBuf; - bool gotoResume; + bool returnResult; char *mark[MARK_SLOTS]; }; |