diff options
author | Adrian Thurston <thurston@complang.org> | 2009-03-04 04:17:27 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2009-03-04 04:17:27 +0000 |
commit | 67956348fc57ff1f41e044be9055260c5a2248fa (patch) | |
tree | a36ca5e88cb5402b0afbcb027714fe9591976eee | |
parent | 0ac02b94f040b5954c62c67d8dd2239971b4ba3e (diff) | |
download | colm-67956348fc57ff1f41e044be9055260c5a2248fa.tar.gz |
Eliminated PdaRun::run(). We should be pulling tokens from scanner and pushing
them to the parser, rather than calling the scanner and pushing to the parser
from there. This is a small start on that.
-rw-r--r-- | bytecode.cpp | 2 | ||||
-rw-r--r-- | fsmrun.cpp | 9 | ||||
-rw-r--r-- | parsedata.cpp | 4 | ||||
-rw-r--r-- | pdarun.h | 1 |
4 files changed, 5 insertions, 11 deletions
diff --git a/bytecode.cpp b/bytecode.cpp index 75417880..7030d3a5 100644 --- a/bytecode.cpp +++ b/bytecode.cpp @@ -133,7 +133,7 @@ Tree *call_parser( Tree **&sp, Program *prg, Stream *stream, { PdaTables *tables = prg->rtd->pdaTables; PdaRun parser( sp, prg, tables, parserId, stream->scanner, stopId, revertOn ); - parser.run(); + stream->scanner->run( &parser ); commit_full( &parser, 0 ); Tree *tree = parser.getParsedRoot( stopId > 0 ); tree_upref( tree ); @@ -805,13 +805,6 @@ void FsmRun::attachInputStream( InputStream *in ) inputStream->position = 0; } -long PdaRun::run() -{ - /* PDA must be init first to set next region. */ - init(); - return fsmRun->run( this ); -} - long PdaRun::undoParse( Tree *tree, CodeVect *rev ) { /* PDA must be init first to set next region. */ @@ -844,6 +837,8 @@ long FsmRun::run( PdaRun *destParser ) PdaRun *prevParser = parser; parser = destParser; + parser->init(); + act = 0; tokstart = 0; tokend = 0; diff --git a/parsedata.cpp b/parsedata.cpp index 19599e6b..32da2e5c 100644 --- a/parsedata.cpp +++ b/parsedata.cpp @@ -1698,7 +1698,7 @@ void ParseData::parsePatterns() repl->pdaRun = new PdaRun( root, &program, pdaTables, repl->langEl->parserId, &fsmRun, 0, false ); - repl->pdaRun->run(); + fsmRun.run( repl->pdaRun ); //#ifdef COLM_LOG_COMPILE //if ( colm_log_compile ) { @@ -1714,7 +1714,7 @@ void ParseData::parsePatterns() pat->pdaRun = new PdaRun( root, &program, pdaTables, pat->langEl->parserId, &fsmRun, 0, false ); - pat->pdaRun->run(); + fsmRun.run( pat->pdaRun ); //#ifdef COLM_LOG_COMPILE //if ( colm_log_compile ) { @@ -524,7 +524,6 @@ struct PdaRun void parseToken( Kid *input ); bool isParserStopFinished(); void match( Kid *tree, Kid *pattern ); - long run(); long undoParse( Tree *tree, CodeVect *rev ); void send( Kid *kid ); |