diff options
-rw-r--r-- | colm/compiler.cc | 3 | ||||
-rw-r--r-- | colm/pdarun.c | 8 | ||||
-rw-r--r-- | colm/pdarun.h | 6 | ||||
-rw-r--r-- | colm/tree.c | 5 |
4 files changed, 10 insertions, 12 deletions
diff --git a/colm/compiler.cc b/colm/compiler.cc index 687e2791..45eb35cb 100644 --- a/colm/compiler.cc +++ b/colm/compiler.cc @@ -1243,8 +1243,7 @@ PdaRun *Compiler::parsePattern( Program *prg, Tree **sp, const InputLoc &loc, PdaRun *pdaRun = new PdaRun; initStreamImpl( in ); - initPdaRun( pdaRun, prg, pdaTables, fsmRun, parserId, 0, false, 0 ); - initFsmRun( fsmRun, prg ); + initPdaRun( prg, pdaRun, fsmRun, pdaTables, parserId, 0, false, 0 ); Stream *res = streamAllocate( prg ); res->id = LEL_ID_STREAM; diff --git a/colm/pdarun.c b/colm/pdarun.c index 778f6339..5bf9216e 100644 --- a/colm/pdarun.c +++ b/colm/pdarun.c @@ -56,7 +56,7 @@ i = (Tree*)w; \ } while(0) -void initFsmRun( FsmRun *fsmRun, Program *prg ) +static void initFsmRun( Program *prg, FsmRun *fsmRun ) { fsmRun->tables = prg->rtd->fsmTables; @@ -1429,8 +1429,8 @@ int isParserStopFinished( PdaRun *pdaRun ) return done; } -void initPdaRun( PdaRun *pdaRun, Program *prg, PdaTables *tables, - FsmRun *fsmRun, int parserId, long stopTarget, int revertOn, Tree *context ) +void initPdaRun( Program *prg, PdaRun *pdaRun, FsmRun *fsmRun, PdaTables *tables, + int parserId, long stopTarget, int revertOn, Tree *context ) { memset( pdaRun, 0, sizeof(PdaRun) ); pdaRun->tables = tables; @@ -1478,6 +1478,8 @@ void initPdaRun( PdaRun *pdaRun, Program *prg, PdaTables *tables, pdaRun->reject = false; pdaRun->rcBlockCount = 0; + + initFsmRun( prg, fsmRun ); } long stackTopTarget( Program *prg, PdaRun *pdaRun ) diff --git a/colm/pdarun.h b/colm/pdarun.h index d7e83772..c43997f7 100644 --- a/colm/pdarun.h +++ b/colm/pdarun.h @@ -92,14 +92,12 @@ typedef struct _FsmRun long matchedToken; } FsmRun; -void initFsmRun( FsmRun *fsmRun, struct ColmProgram *prg ); void clearFsmRun( struct ColmProgram *prg, FsmRun *fsmRun ); void updatePosition( StreamImpl *inputStream, const char *data, long length ); void undoPosition( StreamImpl *inputStream, const char *data, long length ); void sendBackRunBufHead( FsmRun *fsmRun, StreamImpl *inputStream ); void undoStreamPull( StreamImpl *inputStream, const char *data, long length ); - #if SIZEOF_LONG != 4 && SIZEOF_LONG != 8 #error "SIZEOF_LONG contained an unexpected value" #endif @@ -400,8 +398,8 @@ void decrementSteps( PdaRun *pdaRun ); int makeReverseCode( PdaRun *pdaRun ); void transferReverseCode( PdaRun *pdaRun, ParseTree *tree ); -void initPdaRun( PdaRun *pdaRun, struct ColmProgram *prg, PdaTables *tables, - FsmRun *fsmRun, int parserId, long stopTarget, int revertOn, Tree *context ); +void initPdaRun( struct ColmProgram *prg, PdaRun *pdaRun, FsmRun *fsmRun, PdaTables *tables, + int parserId, long stopTarget, int revertOn, Tree *context ); void clearPdaRun( struct ColmProgram *prg, Tree **root, PdaRun *pdaRun ); void initStreamImpl( StreamImpl *inputStream ); diff --git a/colm/tree.c b/colm/tree.c index edd0dc79..b14273f5 100644 --- a/colm/tree.c +++ b/colm/tree.c @@ -990,9 +990,8 @@ Tree *createGeneric( Program *prg, long genericId ) parser->pdaRun = malloc( sizeof(PdaRun) ); /* Start off the parsing process. */ - initPdaRun( parser->pdaRun, prg, prg->rtd->pdaTables, - parser->fsmRun, genericInfo->parserId, false, false, 0 ); - initFsmRun( parser->fsmRun, prg ); + initPdaRun( prg, parser->pdaRun, parser->fsmRun, prg->rtd->pdaTables, + genericInfo->parserId, false, false, 0 ); newToken( prg, parser->pdaRun, parser->fsmRun ); newGeneric = (Tree*) parser; |