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 | a38bc6696d82b082d48125fb42340b4e8fc635da (patch) | |
tree | 658531e4c23bfdf89616da7fdc367610933f2788 | |
parent | 82123d34d3bc28bce9e75be756acc016e6560561 (diff) | |
download | colm-a38bc6696d82b082d48125fb42340b4e8fc635da.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-- | colm/bytecode.cpp | 2 | ||||
-rw-r--r-- | colm/fsmrun.cpp | 9 | ||||
-rw-r--r-- | colm/parsedata.cpp | 4 | ||||
-rw-r--r-- | colm/pdarun.h | 1 |
4 files changed, 5 insertions, 11 deletions
diff --git a/colm/bytecode.cpp b/colm/bytecode.cpp index 75417880..7030d3a5 100644 --- a/colm/bytecode.cpp +++ b/colm/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 ); diff --git a/colm/fsmrun.cpp b/colm/fsmrun.cpp index 6f184b35..7281c76b 100644 --- a/colm/fsmrun.cpp +++ b/colm/fsmrun.cpp @@ -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/colm/parsedata.cpp b/colm/parsedata.cpp index 19599e6b..32da2e5c 100644 --- a/colm/parsedata.cpp +++ b/colm/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 ) { diff --git a/colm/pdarun.h b/colm/pdarun.h index 30f5b0d2..9baa5edb 100644 --- a/colm/pdarun.h +++ b/colm/pdarun.h @@ -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 ); |