diff options
author | Adrian Thurston <thurston@complang.org> | 2008-11-06 22:56:23 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2008-11-06 22:56:23 +0000 |
commit | c9aed990d4a391c10eb32282ffa88fa6576c25d2 (patch) | |
tree | 3de7bc5e11b4033a9fc80faa6a22ffd52d56dc6b | |
parent | a9e75a2620a9ccd7f19534c251d318d4ffccd72f (diff) | |
download | colm-c9aed990d4a391c10eb32282ffa88fa6576c25d2.tar.gz |
Stop using AF_IGNORE, a peek into lelInfo is the right way to determine if a
tree to be ignored.
-rw-r--r-- | colm/bytecode.cpp | 2 | ||||
-rw-r--r-- | colm/bytecode.h | 3 | ||||
-rw-r--r-- | colm/fsmrun.cpp | 10 |
3 files changed, 8 insertions, 7 deletions
diff --git a/colm/bytecode.cpp b/colm/bytecode.cpp index fc4f862b..5f7c4dab 100644 --- a/colm/bytecode.cpp +++ b/colm/bytecode.cpp @@ -100,8 +100,6 @@ void send( Tree **root, Program *prg, PdaRun *parser, Tree *tree, bool ignore ) tree->id = prg->rtd->lelInfo[tree->id].termDupId; tree->alg->flags |= AF_ARTIFICIAL; - if ( ignore ) - tree->alg->flags |= AF_IGNORE; /* FIXME: Do we need to remove the ignore tokens * at this point? Will it cause a leak? */ diff --git a/colm/bytecode.h b/colm/bytecode.h index ad0a7faa..aa5d185d 100644 --- a/colm/bytecode.h +++ b/colm/bytecode.h @@ -247,8 +247,7 @@ typedef unsigned char uchar; #define AF_ARTIFICIAL 0x8 #define AF_NAMED 0x10 #define AF_GROUP_MEM 0x20 -#define AF_IGNORE 0x40 -#define AF_HAS_RCODE 0x80 +#define AF_HAS_RCODE 0x40 /* * Call stack. diff --git a/colm/fsmrun.cpp b/colm/fsmrun.cpp index 993936f6..de85591d 100644 --- a/colm/fsmrun.cpp +++ b/colm/fsmrun.cpp @@ -326,11 +326,13 @@ void FsmRun::sendBack( Kid *input ) * generated from a single action. */ void set_AF_GROUP_MEM( PdaRun *parser ) { - /* Set AF_GROUP_MEM now. */ + LangElInfo *lelInfo = parser->prg->rtd->lelInfo; + long sendCount = 0; Kid *queued = parser->queue; while ( queued != 0 ) { - if ( !(queued->tree->alg->flags & AF_IGNORE) ) { + /* Only bother with non-ignore tokens. */ + if ( !lelInfo[queued->tree->id].ignore ) { if ( sendCount > 0 ) queued->tree->alg->flags |= AF_GROUP_MEM; sendCount += 1; @@ -387,6 +389,8 @@ void FsmRun::sendEOF( ) void send_queued_tokens( FsmRun *fsmRun, PdaRun *parser ) { + LangElInfo *lelInfo = fsmRun->prg->rtd->lelInfo; + while ( parser->queue != 0 ) { /* Pull an item to send off the queue. */ Kid *send = parser->queue; @@ -394,7 +398,7 @@ void send_queued_tokens( FsmRun *fsmRun, PdaRun *parser ) /* Must clear next, since the parsing algorithm uses it. */ send->next = 0; - if ( send->tree->alg->flags & AF_IGNORE ) { + if ( lelInfo[send->tree->id].ignore ) { #ifdef COLM_LOG_PARSE cerr << "ignoring queued item: " << parser->tables->gbl->lelInfo[send->tree->id].name << endl; |