summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-02-03 14:55:24 -0500
committerAdrian Thurston <thurston@complang.org>2013-02-03 14:55:24 -0500
commitd86eb63c48139c9b5a9951137bc0bfbf6137658e (patch)
tree26687853008089ea2c1ccbaa8a0b7cc524db9c33
parente3cdaaeadc86e45f7f2c365f5a61a5a060c6f10b (diff)
downloadcolm-d86eb63c48139c9b5a9951137bc0bfbf6137658e.tar.gz
don't touch p in the FSM execution, wrecks the have computation
-rw-r--r--colm/fsmcodegen.cc8
-rw-r--r--colm/fsmexec.cc6
-rw-r--r--colm/pdarun.c3
3 files changed, 10 insertions, 7 deletions
diff --git a/colm/fsmcodegen.cc b/colm/fsmcodegen.cc
index 212de648..30abf796 100644
--- a/colm/fsmcodegen.cc
+++ b/colm/fsmcodegen.cc
@@ -172,14 +172,14 @@ void FsmCodeGen::LM_SWITCH( ostream &ret, InlineItem *item,
int targState, int inFinish )
{
ret <<
- " " << P() << " = " << TOKEND() << ";\n"
+ //" " << P() << " = " << TOKEND() << ";\n"
" switch( " << ACT() << " ) {\n";
/* If the switch handles error then we also forced the error state. It
* will exist. */
if ( item->tokenRegion->lmSwitchHandlesError ) {
- ret << " case 0: " << P() << " = " << TOKSTART() <<
- "; goto st" << redFsm->errState->id << ";\n";
+ ret << " case 0: " //<< P() << " = " << TOKSTART() << ";" <<
+ "goto st" << redFsm->errState->id << ";\n";
}
for ( TokenDefListReg::Iter lmi = item->tokenRegion->tokenDefList; lmi.lte(); lmi++ ) {
@@ -218,7 +218,7 @@ void FsmCodeGen::LM_ON_LAG_BEHIND( ostream &ret, InlineItem *item )
{
assert( item->longestMatchPart->tdLangEl != 0 );
- ret << " " << P() << " = " << TOKEND() << ";\n";
+// ret << " " << P() << " = " << TOKEND() << ";\n";
EMIT_TOKEN( ret, item->longestMatchPart->tdLangEl );
ret << " return;\n";
}
diff --git a/colm/fsmexec.cc b/colm/fsmexec.cc
index 9b945374..bb24e086 100644
--- a/colm/fsmexec.cc
+++ b/colm/fsmexec.cc
@@ -56,9 +56,9 @@ void execAction( FsmRun *fsmRun, GenAction *genAction )
case InlineItem::LmSwitch:
/* If the switch handles error then we also forced the error state. It
* will exist. */
- fsmRun->p = fsmRun->tokend;
+ //fsmRun->p = fsmRun->tokend;
if ( item->tokenRegion->lmSwitchHandlesError && fsmRun->act == 0 ) {
- fsmRun->p = fsmRun->tokstart;
+ //fsmRun->p = fsmRun->tokstart;
fsmRun->cs = fsmRun->tables->errorState;
}
else {
@@ -81,7 +81,7 @@ void execAction( FsmRun *fsmRun, GenAction *genAction )
fsmRun->returnResult = true;
break;
case InlineItem::LmOnLagBehind:
- fsmRun->p = fsmRun->tokend;
+ //fsmRun->p = fsmRun->tokend;
fsmRun->matchedToken = item->longestMatchPart->tdLangEl->id;
fsmRun->returnResult = true;
break;
diff --git a/colm/pdarun.c b/colm/pdarun.c
index b810a1be..2f071a3c 100644
--- a/colm/pdarun.c
+++ b/colm/pdarun.c
@@ -788,6 +788,8 @@ Head *extractMatch( Program *prg, FsmRun *fsmRun, StreamImpl *is )
{
long length = fsmRun->have;
+ debug( REALM_PARSE, "extracting token of length: %ld\n", length );
+
RunBuf *runBuf = newRunBuf();
runBuf->next = fsmRun->consumeBuf;
fsmRun->consumeBuf = runBuf;
@@ -1074,6 +1076,7 @@ long scanToken( Program *prg, PdaRun *pdaRun, FsmRun *fsmRun, StreamImpl *is )
break;
case INPUT_EOD:
+ fsmRun->p = fsmRun->pe = 0;
return SCAN_TRY_AGAIN_LATER;
case INPUT_LANG_EL: