summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-05-10 13:55:46 -0400
committerAdrian Thurston <thurston@complang.org>2015-05-10 13:55:46 -0400
commit26ba9ef6c965fed03f081054bdb11d212e55f311 (patch)
tree0da628ce54880121fe7af7b7b9cf5b0f2d30dee4 /src
parentbb0f6a3e4a9117674eb91eb1226bb1b692319c4b (diff)
downloadcolm-26ba9ef6c965fed03f081054bdb11d212e55f311.tar.gz
merged FsmRun and PdaRun into pda_run, eliminated typedef
Diffstat (limited to 'src')
-rw-r--r--src/bytecode.c14
-rw-r--r--src/bytecode.h4
-rw-r--r--src/compiler.cc4
-rw-r--r--src/compiler.h4
-rw-r--r--src/ctinput.cc9
-rw-r--r--src/fsmcodegen.cc12
-rw-r--r--src/fsmcodegen.h2
-rw-r--r--src/fsmexec.cc120
-rw-r--r--src/input.h18
-rw-r--r--src/parsetree.h8
-rw-r--r--src/pdacodegen.h10
-rw-r--r--src/pdarun.c355
-rw-r--r--src/pdarun.h101
-rw-r--r--src/program.h10
-rw-r--r--src/struct.c2
-rw-r--r--src/struct.h2
-rw-r--r--src/tree.c2
17 files changed, 321 insertions, 356 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 31d6793b..8856d24c 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -198,7 +198,7 @@ static void stream_undo_append_stream( Program *prg, Tree **sp, StreamImpl *is,
is->funcs->undoAppendStream( is );
}
-static Tree *stream_pull_bc( Program *prg, Tree **sp, PdaRun *pdaRun,
+static Tree *stream_pull_bc( Program *prg, Tree **sp, struct pda_run *pdaRun,
Stream *stream, Tree *length )
{
long len = ((long)length);
@@ -474,7 +474,7 @@ Tree *colm_run_func( struct colm_program *prg, int frameId,
};
-int colm_make_reverse_code( PdaRun *pdaRun )
+int colm_make_reverse_code( struct pda_run *pdaRun )
{
RtCodeVect *reverseCode = &pdaRun->reverseCode;
RtCodeVect *rcodeCollect = &pdaRun->rcodeCollect;
@@ -520,7 +520,7 @@ int colm_make_reverse_code( PdaRun *pdaRun )
return true;
}
-void colm_transfer_reverse_code( PdaRun *pdaRun, ParseTree *parseTree )
+void colm_transfer_reverse_code( struct pda_run *pdaRun, ParseTree *parseTree )
{
if ( pdaRun->rcBlockCount > 0 ) {
//debug( REALM_PARSE, "attaching reverse code to token\n" );
@@ -843,7 +843,7 @@ again:
/* If there are captures (this is a translate block) then copy them into
* the local frame now. */
LangElInfo *lelInfo = prg->rtd->lelInfo;
- char **mark = exec->parser->pdaRun->fsmRun->mark;
+ char **mark = exec->parser->pdaRun->mark;
int i;
for ( i = 0; i < lelInfo[exec->parser->pdaRun->tokenId].numCaptureAttr; i++ ) {
@@ -2266,7 +2266,7 @@ again:
debug( prg, REALM_BYTECODE, "IN_PARSE_LOAD\n" );
Parser *parser = vm_pop_parser();
- PdaRun *pdaRun = parser->pdaRun;
+ struct pda_run *pdaRun = parser->pdaRun;
long steps = pdaRun->steps;
vm_push_parser( exec->parser );
@@ -2589,7 +2589,7 @@ again:
Stream *stream = vm_pop_stream();
Tree *len = vm_pop_tree();
- PdaRun *pdaRun = exec->parser != 0 ? exec->parser->pdaRun : 0;
+ struct pda_run *pdaRun = exec->parser != 0 ? exec->parser->pdaRun : 0;
Tree *string = stream_pull_bc( prg, sp, pdaRun, stream, len );
treeUpref( string );
vm_push_tree( string );
@@ -2609,7 +2609,7 @@ again:
Stream *stream = vm_pop_stream();
Tree *len = vm_pop_tree();
- PdaRun *pdaRun = exec->parser != 0 ? exec->parser->pdaRun : 0;
+ struct pda_run *pdaRun = exec->parser != 0 ? exec->parser->pdaRun : 0;
Tree *string = stream_pull_bc( prg, sp, pdaRun, stream, len );
treeUpref( string );
vm_push_tree( string );
diff --git a/src/bytecode.h b/src/bytecode.h
index 330277ee..bb56b958 100644
--- a/src/bytecode.h
+++ b/src/bytecode.h
@@ -656,8 +656,8 @@ Kid *getAttrKid( Tree *tree, long pos );
Tree *splitTree( struct colm_program *prg, Tree *t );
void colm_rcode_downref_all( struct colm_program *prg, Tree **sp, RtCodeVect *cv );
-int colm_make_reverse_code( PdaRun *pdaRun );
-void colm_transfer_reverse_code( PdaRun *pdaRun, ParseTree *tree );
+int colm_make_reverse_code( struct pda_run *pdaRun );
+void colm_transfer_reverse_code( struct pda_run *pdaRun, ParseTree *tree );
void splitRef( struct colm_program *prg, Tree ***sp, Ref *fromRef );
diff --git a/src/compiler.cc b/src/compiler.cc
index 4f86c3ad..5f6333f2 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -978,12 +978,12 @@ void Compiler::initEmptyScanners()
}
}
-PdaRun *Compiler::parsePattern( Program *prg, Tree **sp, const InputLoc &loc,
+pda_run *Compiler::parsePattern( Program *prg, Tree **sp, const InputLoc &loc,
int parserId, StreamImpl *sourceStream )
{
StreamImpl *in = colm_impl_new_generic( "<internal>" );
- PdaRun *pdaRun = new PdaRun;
+ struct pda_run *pdaRun = new pda_run;
colm_pda_init( prg, pdaRun, pdaTables, parserId, 0, false, 0 );
Stream *stream = colm_stream_new_struct( prg );
diff --git a/src/compiler.h b/src/compiler.h
index 3ffbabe2..5ce92424 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -88,7 +88,7 @@ struct ProdElList;
struct PdaLiteral;
struct Production;
-/* A pointer to this is in PdaRun, but it's specification is not known by the
+/* A pointer to this is in struct pda_run, but it's specification is not known by the
* runtime code. The runtime functions that access it are defined in
* ctinput.cpp and stubbed in fsmcodegen.cpp */
struct Bindings
@@ -735,7 +735,7 @@ struct Compiler
void addPushBackLHS( Production *prod, CodeVect &code, long &insertPos );
void prepGrammar();
- PdaRun *parsePattern( Program *prg, Tree **sp, const InputLoc &loc,
+ struct pda_run *parsePattern( Program *prg, Tree **sp, const InputLoc &loc,
int parserId, StreamImpl *sourceStream );
void parsePatterns();
diff --git a/src/ctinput.cc b/src/ctinput.cc
index 5ff8ddde..be856a9f 100644
--- a/src/ctinput.cc
+++ b/src/ctinput.cc
@@ -24,6 +24,7 @@
#include "input.h"
#include "debug.h"
#include "pool.h"
+#include "pdacodegen.h"
#include <iostream>
@@ -447,7 +448,7 @@ StreamFuncs replFuncs =
};
extern "C" void internalSendNamedLangEl( Program *prg, Tree **sp,
- PdaRun *pdaRun, FsmRun *fsmRun, StreamImpl *is )
+ pda_run *pdaRun, StreamImpl *is )
{
/* All three set by consumeLangEl. */
long bindId;
@@ -478,20 +479,20 @@ extern "C" void internalSendNamedLangEl( Program *prg, Tree **sp,
pdaRun->parseInput = parseTree;
}
-extern "C" void internalInitBindings( PdaRun *pdaRun )
+extern "C" void internalInitBindings( pda_run *pdaRun )
{
/* Bindings are indexed at 1. Need a no-binding. */
pdaRun->bindings = new Bindings;
pdaRun->bindings->push(0);
}
-void pushBinding( PdaRun *pdaRun, ParseTree *parseTree )
+void pushBinding( pda_run *pdaRun, ParseTree *parseTree )
{
/* If the item is bound then store it in the bindings array. */
pdaRun->bindings->push( parseTree );
}
-extern "C" void internalPopBinding( PdaRun *pdaRun, ParseTree *parseTree )
+extern "C" void internalPopBinding( pda_run *pdaRun, ParseTree *parseTree )
{
ParseTree *lastBound = pdaRun->bindings->top();
if ( lastBound == parseTree )
diff --git a/src/fsmcodegen.cc b/src/fsmcodegen.cc
index e762a1cf..ee9326b6 100644
--- a/src/fsmcodegen.cc
+++ b/src/fsmcodegen.cc
@@ -95,7 +95,7 @@ string FsmCodeGen::CS()
{
ostringstream ret;
/* Expression for retrieving the key, use simple dereference. */
- ret << ACCESS() << "cs";
+ ret << ACCESS() << "fsm_cs";
return ret.str();
}
@@ -848,9 +848,9 @@ void FsmCodeGen::writeExec()
setLabelsNeeded();
out <<
- "static void fsmExecute( FsmRun *fsmRun, StreamImpl *inputStream )\n"
+ "static void fsmExecute( struct pda_run *pdaRun, StreamImpl *inputStream )\n"
"{\n"
- " " << BLOCK_START() << " = fsmRun->p;\n"
+ " " << BLOCK_START() << " = pdaRun->p;\n"
"/*_resume:*/\n";
if ( redFsm->errState != 0 ) {
@@ -901,9 +901,9 @@ void FsmCodeGen::writeCode()
* should use the preprocessor to make these go away. */
out <<
"static void sendNamedLangEl( struct colm_program *prg, Tree **tree,\n"
- " PdaRun *pdaRun, FsmRun *fsmRun, StreamImpl *inputStream ) { }\n"
- "static void initBindings( PdaRun *pdaRun ) {}\n"
- "static void popBinding( PdaRun *pdaRun, ParseTree *tree ) {}\n"
+ " struct pda_run *pdaRun, StreamImpl *inputStream ) { }\n"
+ "static void initBindings( struct pda_run *pdaRun ) {}\n"
+ "static void popBinding( struct pda_run *pdaRun, ParseTree *tree ) {}\n"
"\n"
"\n";
}
diff --git a/src/fsmcodegen.h b/src/fsmcodegen.h
index 17678917..9b892dc7 100644
--- a/src/fsmcodegen.h
+++ b/src/fsmcodegen.h
@@ -94,7 +94,7 @@ protected:
string UINT();
string GET_KEY();
- string ACCESS() { return "fsmRun->"; }
+ string ACCESS() { return "pdaRun->"; }
string P() { return ACCESS() + "p"; }
string PE() { return ACCESS() + "pe"; }
diff --git a/src/fsmexec.cc b/src/fsmexec.cc
index 12f0f3a8..f1e257c3 100644
--- a/src/fsmexec.cc
+++ b/src/fsmexec.cc
@@ -30,7 +30,7 @@
#include "pdarun.h"
#include "global.h"
-void execAction( FsmRun *fsmRun, GenAction *genAction )
+void execAction( struct pda_run *pdaRun, GenAction *genAction )
{
for ( InlineList::Iter item = *genAction->inlineList; item.lte(); item++ ) {
switch ( item->type ) {
@@ -38,61 +38,61 @@ void execAction( FsmRun *fsmRun, GenAction *genAction )
assert(false);
break;
case InlineItem::LmSetActId:
- fsmRun->act = item->longestMatchPart->longestMatchId;
+ pdaRun->act = item->longestMatchPart->longestMatchId;
break;
case InlineItem::LmSetTokEnd:
- fsmRun->tokend = fsmRun->toklen + ( fsmRun->p - fsmRun->start ) + 1;
+ pdaRun->tokend = pdaRun->toklen + ( pdaRun->p - pdaRun->start ) + 1;
break;
case InlineItem::LmInitTokStart:
assert(false);
break;
case InlineItem::LmInitAct:
- fsmRun->act = 0;
+ pdaRun->act = 0;
break;
case InlineItem::LmSetTokStart:
- fsmRun->tokstart = fsmRun->p;
+ pdaRun->tokstart = pdaRun->p;
break;
case InlineItem::LmSwitch:
/* If the switch handles error then we also forced the error state. It
* will exist. */
- fsmRun->toklen = fsmRun->tokend;
- if ( item->tokenRegion->lmSwitchHandlesError && fsmRun->act == 0 ) {
- fsmRun->cs = fsmRun->tables->errorState;
+ pdaRun->toklen = pdaRun->tokend;
+ if ( item->tokenRegion->lmSwitchHandlesError && pdaRun->act == 0 ) {
+ pdaRun->fsm_cs = pdaRun->fsm_tables->errorState;
}
else {
for ( TokenInstanceListReg::Iter lmi = item->tokenRegion->tokenInstanceList;
lmi.lte(); lmi++ )
{
- if ( lmi->inLmSelect && fsmRun->act == lmi->longestMatchId )
- fsmRun->matchedToken = lmi->tokenDef->tdLangEl->id;
+ if ( lmi->inLmSelect && pdaRun->act == lmi->longestMatchId )
+ pdaRun->matchedToken = lmi->tokenDef->tdLangEl->id;
}
}
- fsmRun->returnResult = true;
- fsmRun->skipToklen = true;
+ pdaRun->returnResult = true;
+ pdaRun->skipToklen = true;
break;
case InlineItem::LmOnLast:
- fsmRun->p += 1;
- fsmRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
- fsmRun->returnResult = true;
+ pdaRun->p += 1;
+ pdaRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
+ pdaRun->returnResult = true;
break;
case InlineItem::LmOnNext:
- fsmRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
- fsmRun->returnResult = true;
+ pdaRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
+ pdaRun->returnResult = true;
break;
case InlineItem::LmOnLagBehind:
- fsmRun->toklen = fsmRun->tokend;
- fsmRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
- fsmRun->returnResult = true;
- fsmRun->skipToklen = true;
+ pdaRun->toklen = pdaRun->tokend;
+ pdaRun->matchedToken = item->longestMatchPart->tokenDef->tdLangEl->id;
+ pdaRun->returnResult = true;
+ pdaRun->skipToklen = true;
break;
}
}
if ( genAction->markType == MarkMark )
- fsmRun->mark[genAction->markId-1] = fsmRun->p;
+ pdaRun->mark[genAction->markId-1] = pdaRun->p;
}
-extern "C" void internalFsmExecute( FsmRun *fsmRun, StreamImpl *inputStream )
+extern "C" void internalFsmExecute( struct pda_run *pdaRun, StreamImpl *inputStream )
{
int _klen;
unsigned int _trans;
@@ -100,28 +100,28 @@ extern "C" void internalFsmExecute( FsmRun *fsmRun, StreamImpl *inputStream )
unsigned int _nacts;
const char *_keys;
- fsmRun->start = fsmRun->p;
+ pdaRun->start = pdaRun->p;
/* Init the token match to nothing (the sentinal). */
- fsmRun->matchedToken = 0;
+ pdaRun->matchedToken = 0;
/*_resume:*/
- if ( fsmRun->cs == fsmRun->tables->errorState )
+ if ( pdaRun->fsm_cs == pdaRun->fsm_tables->errorState )
goto out;
- if ( fsmRun->p == fsmRun->pe )
+ if ( pdaRun->p == pdaRun->pe )
goto out;
_loop_head:
- _acts = fsmRun->tables->actions + fsmRun->tables->fromStateActions[fsmRun->cs];
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->fromStateActions[pdaRun->fsm_cs];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
- execAction( fsmRun, fsmRun->tables->actionSwitch[*_acts++] );
+ execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
- _keys = fsmRun->tables->transKeys + fsmRun->tables->keyOffsets[fsmRun->cs];
- _trans = fsmRun->tables->indexOffsets[fsmRun->cs];
+ _keys = pdaRun->fsm_tables->transKeys + pdaRun->fsm_tables->keyOffsets[pdaRun->fsm_cs];
+ _trans = pdaRun->fsm_tables->indexOffsets[pdaRun->fsm_cs];
- _klen = fsmRun->tables->singleLengths[fsmRun->cs];
+ _klen = pdaRun->fsm_tables->singleLengths[pdaRun->fsm_cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
@@ -131,9 +131,9 @@ _loop_head:
break;
_mid = _lower + ((_upper-_lower) >> 1);
- if ( (*fsmRun->p) < *_mid )
+ if ( (*pdaRun->p) < *_mid )
_upper = _mid - 1;
- else if ( (*fsmRun->p) > *_mid )
+ else if ( (*pdaRun->p) > *_mid )
_lower = _mid + 1;
else {
_trans += (_mid - _keys);
@@ -144,7 +144,7 @@ _loop_head:
_trans += _klen;
}
- _klen = fsmRun->tables->rangeLengths[fsmRun->cs];
+ _klen = pdaRun->fsm_tables->rangeLengths[pdaRun->fsm_cs];
if ( _klen > 0 ) {
const char *_lower = _keys;
const char *_mid;
@@ -154,9 +154,9 @@ _loop_head:
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
- if ( (*fsmRun->p) < _mid[0] )
+ if ( (*pdaRun->p) < _mid[0] )
_upper = _mid - 2;
- else if ( (*fsmRun->p) > _mid[1] )
+ else if ( (*pdaRun->p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += ((_mid - _keys)>>1);
@@ -167,48 +167,48 @@ _loop_head:
}
_match:
- fsmRun->cs = fsmRun->tables->transTargsWI[_trans];
+ pdaRun->fsm_cs = pdaRun->fsm_tables->transTargsWI[_trans];
- if ( fsmRun->tables->transActionsWI[_trans] == 0 )
+ if ( pdaRun->fsm_tables->transActionsWI[_trans] == 0 )
goto _again;
- fsmRun->returnResult = false;
- fsmRun->skipToklen = false;
- _acts = fsmRun->tables->actions + fsmRun->tables->transActionsWI[_trans];
+ pdaRun->returnResult = false;
+ pdaRun->skipToklen = false;
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->transActionsWI[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
- execAction( fsmRun, fsmRun->tables->actionSwitch[*_acts++] );
- if ( fsmRun->returnResult ) {
- if ( fsmRun->skipToklen )
+ execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
+ if ( pdaRun->returnResult ) {
+ if ( pdaRun->skipToklen )
goto skip_toklen;
goto final;
}
_again:
- _acts = fsmRun->tables->actions + fsmRun->tables->toStateActions[fsmRun->cs];
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->toStateActions[pdaRun->fsm_cs];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
- execAction( fsmRun, fsmRun->tables->actionSwitch[*_acts++] );
+ execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
- if ( fsmRun->cs == fsmRun->tables->errorState )
+ if ( pdaRun->fsm_cs == pdaRun->fsm_tables->errorState )
goto out;
- if ( ++fsmRun->p != fsmRun->pe )
+ if ( ++pdaRun->p != pdaRun->pe )
goto _loop_head;
out:
- if ( fsmRun->eof ) {
- fsmRun->returnResult = false;
- fsmRun->skipToklen = false;
- _acts = fsmRun->tables->actions + fsmRun->tables->eofActions[fsmRun->cs];
+ if ( pdaRun->eof ) {
+ pdaRun->returnResult = false;
+ pdaRun->skipToklen = false;
+ _acts = pdaRun->fsm_tables->actions + pdaRun->fsm_tables->eofActions[pdaRun->fsm_cs];
_nacts = (unsigned int) *_acts++;
- if ( fsmRun->tables->eofTargs[fsmRun->cs] >= 0 )
- fsmRun->cs = fsmRun->tables->eofTargs[fsmRun->cs];
+ if ( pdaRun->fsm_tables->eofTargs[pdaRun->fsm_cs] >= 0 )
+ pdaRun->fsm_cs = pdaRun->fsm_tables->eofTargs[pdaRun->fsm_cs];
while ( _nacts-- > 0 )
- execAction( fsmRun, fsmRun->tables->actionSwitch[*_acts++] );
- if ( fsmRun->returnResult ) {
- if ( fsmRun->skipToklen )
+ execAction( pdaRun, pdaRun->fsm_tables->actionSwitch[*_acts++] );
+ if ( pdaRun->returnResult ) {
+ if ( pdaRun->skipToklen )
goto skip_toklen;
goto final;
}
@@ -216,8 +216,8 @@ out:
final:
- if ( fsmRun->p != 0 )
- fsmRun->toklen += fsmRun->p - fsmRun->start;
+ if ( pdaRun->p != 0 )
+ pdaRun->toklen += pdaRun->p - pdaRun->start;
skip_toklen:
{}
}
diff --git a/src/input.h b/src/input.h
index 89bfe4b1..095a643c 100644
--- a/src/input.h
+++ b/src/input.h
@@ -40,29 +40,11 @@ extern "C" {
#define INPUT_TREE 6
#define INPUT_IGNORE 7
-/*
- * pdaRun <- fsmRun <- stream
- *
- * Activities we need to support:
- *
- * 1. Stuff data into an input stream each time we <<
- * 2. Detach an input stream, and attach another when we include
- * 3. Send data back to an input stream when the parser backtracks
- * 4. Temporarily stop parsing due to a lack of input.
- *
- * At any given time, the fsmRun struct may have a prefix of the stream's
- * input. If getting data we first get what we can out of the fsmRun, then
- * consult the stream. If sending data back, we first shift pointers in the
- * fsmRun, then ship to the stream. If changing streams the old stream needs to
- * take back unprocessed data from the fsmRun.
- */
-
struct LangEl;
struct Pattern;
struct PatternItem;
struct Constructor;
struct ConsItem;
-struct _FsmRun;
struct colm_tree;
struct colm_stream;
struct colm_location;
diff --git a/src/parsetree.h b/src/parsetree.h
index fd27f75c..0afb8e90 100644
--- a/src/parsetree.h
+++ b/src/parsetree.h
@@ -54,7 +54,6 @@
struct NameInst;
struct FsmGraph;
struct RedFsm;
-struct _FsmRun;
struct ObjectDef;
struct ElementOf;
struct UniqueType;
@@ -66,7 +65,6 @@ struct TypeAlias;
struct RegionSet;
struct NameScope;
struct IterCall;
-typedef struct _PdaRun PdaRun;
/*
* Code Vector
@@ -1668,7 +1666,7 @@ struct Pattern
PatternItemList *list;
long patRepId;
LangEl *langEl;
- PdaRun *pdaRun;
+ struct pda_run *pdaRun;
long nextBindId;
Pattern *prev, *next;
};
@@ -1697,7 +1695,7 @@ struct Constructor
ConsItemList *list;
int patRepId;
LangEl *langEl;
- PdaRun *pdaRun;
+ struct pda_run *pdaRun;
long nextBindId;
bool parse;
@@ -1726,7 +1724,7 @@ struct ParserText
Namespace *nspace;
ConsItemList *list;
LangEl *langEl;
- PdaRun *pdaRun;
+ struct pda_run *pdaRun;
long nextBindId;
bool parse;
ParserText *prev, *next;
diff --git a/src/pdacodegen.h b/src/pdacodegen.h
index d49b94df..bdd63904 100644
--- a/src/pdacodegen.h
+++ b/src/pdacodegen.h
@@ -96,11 +96,11 @@ struct PdaCodeGen
extern "C"
{
- void internalFsmExecute( FsmRun *fsmRun, StreamImpl *inputStream );
- void internalSendNamedLangEl( Program *prg, Tree **sp, PdaRun *pdaRun,
- FsmRun *fsmRun, StreamImpl *is );
- void internalInitBindings( PdaRun *pdaRun );
- void internalPopBinding( PdaRun *pdaRun, ParseTree *parseTree );
+ void internalFsmExecute( struct pda_run *pdaRun, StreamImpl *inputStream );
+ void internalSendNamedLangEl( Program *prg, Tree **sp,
+ struct pda_run *pdaRun, StreamImpl *is );
+ void internalInitBindings( struct pda_run *pdaRun );
+ void internalPopBinding( struct pda_run *pdaRun, ParseTree *parseTree );
}
#endif
diff --git a/src/pdarun.c b/src/pdarun.c
index 42d13b94..8388b4d6 100644
--- a/src/pdarun.c
+++ b/src/pdarun.c
@@ -56,24 +56,24 @@
i = (Tree*)w; \
} while(0)
-static void init_fsm_run( Program *prg, FsmRun *fsmRun )
+static void init_fsm_run( Program *prg, struct pda_run *pdaRun )
{
- fsmRun->tables = prg->rtd->fsmTables;
+ pdaRun->fsm_tables = prg->rtd->fsmTables;
- fsmRun->consumeBuf = 0;
+ pdaRun->consumeBuf = 0;
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
- fsmRun->eof = 0;
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
+ pdaRun->eof = 0;
- fsmRun->preRegion = -1;
+ pdaRun->preRegion = -1;
}
-static void clear_fsm_run( Program *prg, FsmRun *fsmRun )
+static void clear_fsm_run( Program *prg, struct pda_run *pdaRun )
{
- if ( fsmRun->consumeBuf != 0 ) {
+ if ( pdaRun->consumeBuf != 0 ) {
/* Transfer the run buf list to the program */
- RunBuf *head = fsmRun->consumeBuf;
+ RunBuf *head = pdaRun->consumeBuf;
RunBuf *tail = head;
while ( tail->next != 0 )
tail = tail->next;
@@ -83,27 +83,26 @@ static void clear_fsm_run( Program *prg, FsmRun *fsmRun )
}
}
-void colm_increment_steps( PdaRun *pdaRun )
+void colm_increment_steps( struct pda_run *pdaRun )
{
pdaRun->steps += 1;
//debug( prg, REALM_PARSE, "steps up to %ld\n", pdaRun->steps );
}
-void colm_decrement_steps( PdaRun *pdaRun )
+void colm_decrement_steps( struct pda_run *pdaRun )
{
pdaRun->steps -= 1;
//debug( prg, REALM_PARSE, "steps down to %ld\n", pdaRun->steps );
}
-Head *colm_stream_pull( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is, long length )
+Head *colm_stream_pull( Program *prg, Tree **sp, struct pda_run *pdaRun, StreamImpl *is, long length )
{
if ( pdaRun != 0 ) {
- FsmRun *fsmRun = pdaRun->fsmRun;
- RunBuf *runBuf = fsmRun->consumeBuf;
+ RunBuf *runBuf = pdaRun->consumeBuf;
if ( length > ( FSM_BUFSIZE - runBuf->length ) ) {
runBuf = newRunBuf();
- runBuf->next = fsmRun->consumeBuf;
- fsmRun->consumeBuf = runBuf;
+ runBuf->next = pdaRun->consumeBuf;
+ pdaRun->consumeBuf = runBuf;
}
char *dest = runBuf->data + runBuf->length;
@@ -114,8 +113,8 @@ Head *colm_stream_pull( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is,
runBuf->length += length;
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
Head *tokdata = stringAllocPointer( prg, dest, length );
tokdata->location = loc;
@@ -194,7 +193,7 @@ static void send_back_tree( StreamImpl *is, Tree *tree )
* PCR_REVERSE
*/
static void send_back_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, StreamImpl *is, ParseTree *parseTree )
+ struct pda_run *pdaRun, StreamImpl *is, ParseTree *parseTree )
{
#ifdef DEBUG
LangElInfo *lelInfo = prg->rtd->lelInfo;
@@ -224,16 +223,14 @@ static void send_back_ignore( Program *prg, Tree **sp,
}
}
-static void reset_token( PdaRun *pdaRun )
+static void reset_token( struct pda_run *pdaRun )
{
- FsmRun *fsmRun = pdaRun->fsmRun;
-
/* If there is a token started, but never finished for a lack of data, we
* must first backup over it. */
- if ( fsmRun->tokstart != 0 ) {
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
- fsmRun->eof = 0;
+ if ( pdaRun->tokstart != 0 ) {
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
+ pdaRun->eof = 0;
}
}
@@ -241,11 +238,9 @@ static void reset_token( PdaRun *pdaRun )
* PCR_REVERSE
*/
-static void send_back( Program *prg, Tree **sp, PdaRun *pdaRun,
+static void send_back( Program *prg, Tree **sp, struct pda_run *pdaRun,
StreamImpl *is, ParseTree *parseTree )
{
- FsmRun *fsmRun = pdaRun->fsmRun;
-
debug( prg, REALM_PARSE, "sending back: %s\n",
prg->rtd->lelInfo[parseTree->id].name );
@@ -302,17 +297,17 @@ static void send_back( Program *prg, Tree **sp, PdaRun *pdaRun,
parseTreeFree( prg, parseTree );
}
-static void set_region( PdaRun *pdaRun, int emptyIgnore, ParseTree *tree )
+static void set_region( struct pda_run *pdaRun, int emptyIgnore, ParseTree *tree )
{
if ( emptyIgnore ) {
/* Recording the next region. */
tree->retryRegion = pdaRun->nextRegionInd;
- if ( pdaRun->tables->tokenRegions[tree->retryRegion+1] != 0 )
+ if ( pdaRun->pda_tables->tokenRegions[tree->retryRegion+1] != 0 )
pdaRun->numRetry += 1;
}
}
-static void ignore_tree( Program *prg, PdaRun *pdaRun, Tree *tree )
+static void ignore_tree( Program *prg, struct pda_run *pdaRun, Tree *tree )
{
int emptyIgnore = pdaRun->accumIgnore == 0;
@@ -327,13 +322,13 @@ static void ignore_tree( Program *prg, PdaRun *pdaRun, Tree *tree )
colm_transfer_reverse_code( pdaRun, parseTree );
- if ( pdaRun->fsmRun->preRegion >= 0 )
+ if ( pdaRun->preRegion >= 0 )
parseTree->flags |= PF_RIGHT_IGNORE;
set_region( pdaRun, emptyIgnore, pdaRun->accumIgnore );
}
-static void ignore_tree_art( Program *prg, PdaRun *pdaRun, Tree *tree )
+static void ignore_tree_art( Program *prg, struct pda_run *pdaRun, Tree *tree )
{
int emptyIgnore = pdaRun->accumIgnore == 0;
@@ -352,7 +347,7 @@ static void ignore_tree_art( Program *prg, PdaRun *pdaRun, Tree *tree )
set_region( pdaRun, emptyIgnore, pdaRun->accumIgnore );
}
-Kid *make_token_with_data( Program *prg, PdaRun *pdaRun,
+Kid *make_token_with_data( Program *prg, struct pda_run *pdaRun,
StreamImpl *is, int id, Head *tokdata )
{
/* Make the token object. */
@@ -378,9 +373,9 @@ Kid *make_token_with_data( Program *prg, PdaRun *pdaRun,
for ( i = 0; i < lelInfo[id].numCaptureAttr; i++ ) {
CaptureAttr *ca = &prg->rtd->captureAttr[lelInfo[id].captureAttr + i];
Head *data = stringAllocFull( prg,
- pdaRun->fsmRun->mark[ca->mark_enter],
- pdaRun->fsmRun->mark[ca->mark_leave] -
- pdaRun->fsmRun->mark[ca->mark_enter] );
+ pdaRun->mark[ca->mark_enter],
+ pdaRun->mark[ca->mark_leave] -
+ pdaRun->mark[ca->mark_enter] );
Tree *string = constructString( prg, data );
treeUpref( string );
colm_tree_set_field( prg, input->tree, ca->offset, string );
@@ -390,7 +385,7 @@ Kid *make_token_with_data( Program *prg, PdaRun *pdaRun,
return input;
}
-static void report_parse_error( Program *prg, Tree **sp, PdaRun *pdaRun )
+static void report_parse_error( Program *prg, Tree **sp, struct pda_run *pdaRun )
{
Kid *kid = pdaRun->btPoint;
Head *deepest = 0;
@@ -454,7 +449,7 @@ static void report_parse_error( Program *prg, Tree **sp, PdaRun *pdaRun )
}
static void attach_right_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, ParseTree *parseTree )
+ struct pda_run *pdaRun, ParseTree *parseTree )
{
if ( pdaRun->accumIgnore == 0 )
return;
@@ -539,7 +534,7 @@ static void attach_right_ignore( Program *prg, Tree **sp,
}
static void attach_left_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, ParseTree *parseTree )
+ struct pda_run *pdaRun, ParseTree *parseTree )
{
/* Reset. */
assert( ! ( parseTree->flags & PF_LEFT_IL_ATTACHED ) );
@@ -595,7 +590,7 @@ static void attach_left_ignore( Program *prg, Tree **sp,
/* Not currently used. Need to revive this. WARNING: untested changes here */
static void detach_right_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, ParseTree *parseTree )
+ struct pda_run *pdaRun, ParseTree *parseTree )
{
/* Right ignore are immediately discarded since they are copies of
* left-ignores. */
@@ -648,7 +643,7 @@ static void detach_right_ignore( Program *prg, Tree **sp,
}
static void detach_left_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, ParseTree *parseTree )
+ struct pda_run *pdaRun, ParseTree *parseTree )
{
/* Detach left. */
Tree *leftIgnore = 0;
@@ -699,7 +694,7 @@ static void detach_left_ignore( Program *prg, Tree **sp,
treeDownref( prg, sp, leftIgnore );
}
-static int is_parser_stop_finished( PdaRun *pdaRun )
+static int is_parser_stop_finished( struct pda_run *pdaRun )
{
int done =
pdaRun->stackTop->next != 0 &&
@@ -708,7 +703,7 @@ static int is_parser_stop_finished( PdaRun *pdaRun )
return done;
}
-static void handle_error( Program *prg, Tree **sp, PdaRun *pdaRun )
+static void handle_error( Program *prg, Tree **sp, struct pda_run *pdaRun )
{
/* Check the result. */
if ( pdaRun->parseError ) {
@@ -723,17 +718,17 @@ static void handle_error( Program *prg, Tree **sp, PdaRun *pdaRun )
}
}
-static Head *extract_match( Program *prg, Tree **sp, FsmRun *fsmRun, StreamImpl *is )
+static Head *extract_match( Program *prg, Tree **sp, struct pda_run *pdaRun, StreamImpl *is )
{
- long length = fsmRun->toklen;
+ long length = pdaRun->toklen;
//debug( prg, REALM_PARSE, "extracting token of length: %ld\n", length );
- RunBuf *runBuf = fsmRun->consumeBuf;
+ RunBuf *runBuf = pdaRun->consumeBuf;
if ( runBuf == 0 || length > ( FSM_BUFSIZE - runBuf->length ) ) {
runBuf = newRunBuf();
- runBuf->next = fsmRun->consumeBuf;
- fsmRun->consumeBuf = runBuf;
+ runBuf->next = pdaRun->consumeBuf;
+ pdaRun->consumeBuf = runBuf;
}
char *dest = runBuf->data + runBuf->length;
@@ -744,9 +739,9 @@ static Head *extract_match( Program *prg, Tree **sp, FsmRun *fsmRun, StreamImpl
runBuf->length += length;
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
- fsmRun->tokstart = 0;
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
+ pdaRun->tokstart = 0;
Head *head = stringAllocPointer( prg, dest, length );
@@ -757,23 +752,23 @@ static Head *extract_match( Program *prg, Tree **sp, FsmRun *fsmRun, StreamImpl
return head;
}
-static Head *peekMatch( Program *prg, FsmRun *fsmRun, StreamImpl *is )
+static Head *peekMatch( Program *prg, struct pda_run *pdaRun, StreamImpl *is )
{
- long length = fsmRun->toklen;
+ long length = pdaRun->toklen;
- RunBuf *runBuf = fsmRun->consumeBuf;
+ RunBuf *runBuf = pdaRun->consumeBuf;
if ( runBuf == 0 || length > ( FSM_BUFSIZE - runBuf->length ) ) {
runBuf = newRunBuf();
- runBuf->next = fsmRun->consumeBuf;
- fsmRun->consumeBuf = runBuf;
+ runBuf->next = pdaRun->consumeBuf;
+ pdaRun->consumeBuf = runBuf;
}
char *dest = runBuf->data + runBuf->length;
is->funcs->getData( is, dest, length );
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
Head *head = stringAllocPointer( prg, dest, length );
@@ -789,12 +784,12 @@ static Head *peekMatch( Program *prg, FsmRun *fsmRun, StreamImpl *is )
static void send_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, StreamImpl *is, long id )
+ struct pda_run *pdaRun, StreamImpl *is, long id )
{
debug( prg, REALM_PARSE, "ignoring: %s\n", prg->rtd->lelInfo[id].name );
/* Make the ignore string. */
- Head *ignoreStr = extract_match( prg, sp, pdaRun->fsmRun, is );
+ Head *ignoreStr = extract_match( prg, sp, pdaRun, is );
debug( prg, REALM_PARSE, "ignoring: %.*s\n", ignoreStr->length, ignoreStr->data );
@@ -808,12 +803,12 @@ static void send_ignore( Program *prg, Tree **sp,
}
static void send_token( Program *prg, Tree **sp,
- PdaRun *pdaRun, StreamImpl *is, long id )
+ struct pda_run *pdaRun, StreamImpl *is, long id )
{
int emptyIgnore = pdaRun->accumIgnore == 0;
/* Make the token data. */
- Head *tokdata = extract_match( prg, sp, pdaRun->fsmRun, is );
+ Head *tokdata = extract_match( prg, sp, pdaRun, is );
debug( prg, REALM_PARSE, "token: %s text: %.*s\n",
prg->rtd->lelInfo[id].name,
@@ -830,11 +825,11 @@ static void send_token( Program *prg, Tree **sp,
pdaRun->parseInput = parseTree;
/* Store any alternate scanning region. */
- if ( input != 0 && pdaRun->cs >= 0 )
+ if ( input != 0 && pdaRun->pda_cs >= 0 )
set_region( pdaRun, emptyIgnore, parseTree );
}
-static void send_tree( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is )
+static void send_tree( Program *prg, Tree **sp, struct pda_run *pdaRun, StreamImpl *is )
{
Kid *input = kidAllocate( prg );
input->tree = is->funcs->consumeTree( is );
@@ -849,14 +844,14 @@ static void send_tree( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is )
pdaRun->parseInput = parseTree;
}
-static void send_ignore_tree( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is )
+static void send_ignore_tree( Program *prg, Tree **sp, struct pda_run *pdaRun, StreamImpl *is )
{
Tree *tree = is->funcs->consumeTree( is );
ignore_tree_art( prg, pdaRun, tree );
}
static void send_collect_ignore( Program *prg, Tree **sp,
- PdaRun *pdaRun, StreamImpl *is, int id )
+ struct pda_run *pdaRun, StreamImpl *is, int id )
{
debug( prg, REALM_PARSE, "token: CI\n" );
@@ -884,25 +879,23 @@ static void send_collect_ignore( Program *prg, Tree **sp,
pdaRun->parseInput = parseTree;
/* Store any alternate scanning region. */
- if ( input != 0 && pdaRun->cs >= 0 )
+ if ( input != 0 && pdaRun->pda_cs >= 0 )
set_region( pdaRun, emptyIgnore, parseTree );
}
/* Offset can be used to look at the next nextRegionInd. */
-static int get_next_region( PdaRun *pdaRun, int offset )
+static int get_next_region( struct pda_run *pdaRun, int offset )
{
- return pdaRun->tables->tokenRegions[pdaRun->nextRegionInd+offset];
+ return pdaRun->pda_tables->tokenRegions[pdaRun->nextRegionInd+offset];
}
-static int get_next_pre_region( PdaRun *pdaRun )
+static int get_next_pre_region( struct pda_run *pdaRun )
{
- return pdaRun->tables->tokenPreRegions[pdaRun->nextRegionInd];
+ return pdaRun->pda_tables->tokenPreRegions[pdaRun->nextRegionInd];
}
-static void send_eof( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is )
+static void send_eof( Program *prg, Tree **sp, struct pda_run *pdaRun, StreamImpl *is )
{
- FsmRun *fsmRun = pdaRun->fsmRun;
-
debug( prg, REALM_PARSE, "token: _EOF\n" );
colm_increment_steps( pdaRun );
@@ -921,9 +914,9 @@ static void send_eof( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is )
input->tree->tokdata = head;
/* Set the state using the state of the parser. */
- fsmRun->region = get_next_region( pdaRun, 0 );
- fsmRun->preRegion = get_next_pre_region( pdaRun );
- fsmRun->cs = fsmRun->tables->entryByRegion[fsmRun->region];
+ pdaRun->region = get_next_region( pdaRun, 0 );
+ pdaRun->preRegion = get_next_pre_region( pdaRun );
+ pdaRun->fsm_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->region];
ParseTree *parseTree = parseTreeAllocate( prg );
parseTree->id = input->tree->id;
@@ -932,37 +925,35 @@ static void send_eof( Program *prg, Tree **sp, PdaRun *pdaRun, StreamImpl *is )
pdaRun->parseInput = parseTree;
}
-static void new_token( Program *prg, PdaRun *pdaRun )
+static void new_token( Program *prg, struct pda_run *pdaRun )
{
- FsmRun *fsmRun = pdaRun->fsmRun;
-
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
- fsmRun->eof = 0;
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
+ pdaRun->eof = 0;
/* Init the scanner vars. */
- fsmRun->act = 0;
- fsmRun->tokstart = 0;
- fsmRun->tokend = 0;
- fsmRun->matchedToken = 0;
+ pdaRun->act = 0;
+ pdaRun->tokstart = 0;
+ pdaRun->tokend = 0;
+ pdaRun->matchedToken = 0;
/* Set the state using the state of the parser. */
- fsmRun->region = get_next_region( pdaRun, 0 );
- fsmRun->preRegion = get_next_pre_region( pdaRun );
- if ( fsmRun->preRegion > 0 ) {
- fsmRun->cs = fsmRun->tables->entryByRegion[fsmRun->preRegion];
- fsmRun->ncs = fsmRun->tables->entryByRegion[fsmRun->region];
+ pdaRun->region = get_next_region( pdaRun, 0 );
+ pdaRun->preRegion = get_next_pre_region( pdaRun );
+ if ( pdaRun->preRegion > 0 ) {
+ pdaRun->fsm_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->preRegion];
+ pdaRun->next_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->region];
}
else {
- fsmRun->cs = fsmRun->tables->entryByRegion[fsmRun->region];
+ pdaRun->fsm_cs = pdaRun->fsm_tables->entryByRegion[pdaRun->region];
}
/* Clear the mark array. */
- memset( fsmRun->mark, 0, sizeof(fsmRun->mark) );
+ memset( pdaRun->mark, 0, sizeof(pdaRun->mark) );
}
-static void push_bt_point( Program *prg, PdaRun *pdaRun )
+static void push_bt_point( Program *prg, struct pda_run *pdaRun )
{
Tree *tree = 0;
if ( pdaRun->accumIgnore != 0 )
@@ -992,108 +983,106 @@ static void push_bt_point( Program *prg, PdaRun *pdaRun )
#define SCAN_LANG_EL -2
#define SCAN_EOF -1
-static long scan_token( Program *prg, PdaRun *pdaRun, StreamImpl *is )
+static long scan_token( Program *prg, struct pda_run *pdaRun, StreamImpl *is )
{
- FsmRun *fsmRun = pdaRun->fsmRun;
-
if ( pdaRun->triggerUndo )
return SCAN_UNDO;
while ( true ) {
char *pd = 0;
int len = 0;
- int type = is->funcs->getParseBlock( is, fsmRun->toklen, &pd, &len );
+ int type = is->funcs->getParseBlock( is, pdaRun->toklen, &pd, &len );
switch ( type ) {
case INPUT_DATA:
- fsmRun->p = pd;
- fsmRun->pe = pd + len;
+ pdaRun->p = pd;
+ pdaRun->pe = pd + len;
break;
case INPUT_EOS:
- fsmRun->p = fsmRun->pe = 0;
- if ( fsmRun->tokstart != 0 )
- fsmRun->eof = 1;
+ pdaRun->p = pdaRun->pe = 0;
+ if ( pdaRun->tokstart != 0 )
+ pdaRun->eof = 1;
debug( prg, REALM_SCAN, "EOS *******************\n" );
break;
case INPUT_EOF:
- fsmRun->p = fsmRun->pe = 0;
- if ( fsmRun->tokstart != 0 )
- fsmRun->eof = 1;
+ pdaRun->p = pdaRun->pe = 0;
+ if ( pdaRun->tokstart != 0 )
+ pdaRun->eof = 1;
else
return SCAN_EOF;
break;
case INPUT_EOD:
- fsmRun->p = fsmRun->pe = 0;
+ pdaRun->p = pdaRun->pe = 0;
return SCAN_TRY_AGAIN_LATER;
case INPUT_LANG_EL:
- if ( fsmRun->tokstart != 0 )
- fsmRun->eof = 1;
+ if ( pdaRun->tokstart != 0 )
+ pdaRun->eof = 1;
else
return SCAN_LANG_EL;
break;
case INPUT_TREE:
- if ( fsmRun->tokstart != 0 )
- fsmRun->eof = 1;
+ if ( pdaRun->tokstart != 0 )
+ pdaRun->eof = 1;
else
return SCAN_TREE;
break;
case INPUT_IGNORE:
- if ( fsmRun->tokstart != 0 )
- fsmRun->eof = 1;
+ if ( pdaRun->tokstart != 0 )
+ pdaRun->eof = 1;
else
return SCAN_IGNORE;
break;
}
- prg->rtd->fsmExecute( fsmRun, is );
+ prg->rtd->fsmExecute( pdaRun, is );
/* First check if scanning stopped because we have a token. */
- if ( fsmRun->matchedToken > 0 ) {
+ if ( pdaRun->matchedToken > 0 ) {
/* If the token has a marker indicating the end (due to trailing
* context) then adjust data now. */
LangElInfo *lelInfo = prg->rtd->lelInfo;
- if ( lelInfo[fsmRun->matchedToken].markId >= 0 )
- fsmRun->p = fsmRun->mark[lelInfo[fsmRun->matchedToken].markId];
+ if ( lelInfo[pdaRun->matchedToken].markId >= 0 )
+ pdaRun->p = pdaRun->mark[lelInfo[pdaRun->matchedToken].markId];
- return fsmRun->matchedToken;
+ return pdaRun->matchedToken;
}
/* Check for error. */
- if ( fsmRun->cs == fsmRun->tables->errorState ) {
+ if ( pdaRun->fsm_cs == pdaRun->fsm_tables->errorState ) {
/* If a token was started, but not finished (tokstart != 0) then
* restore data to the beginning of that token. */
- if ( fsmRun->tokstart != 0 )
- fsmRun->p = fsmRun->tokstart;
+ if ( pdaRun->tokstart != 0 )
+ pdaRun->p = pdaRun->tokstart;
/* Check for a default token in the region. If one is there
* then send it and continue with the processing loop. */
- if ( prg->rtd->regionInfo[fsmRun->region].defaultToken >= 0 ) {
- fsmRun->toklen = 0;
- return prg->rtd->regionInfo[fsmRun->region].defaultToken;
+ if ( prg->rtd->regionInfo[pdaRun->region].defaultToken >= 0 ) {
+ pdaRun->toklen = 0;
+ return prg->rtd->regionInfo[pdaRun->region].defaultToken;
}
return SCAN_ERROR;
}
/* Check for no match on eof (trailing data that partially matches a token). */
- if ( fsmRun->eof )
+ if ( pdaRun->eof )
return SCAN_ERROR;
/* Got here because the state machine didn't match a token or encounter
* an error. Must be because we got to the end of the buffer data. */
- assert( fsmRun->p == fsmRun->pe );
+ assert( pdaRun->p == pdaRun->pe );
}
/* Should not be reached. */
return SCAN_ERROR;
}
-static Tree *get_parsed_root( PdaRun *pdaRun, int stop )
+static Tree *get_parsed_root( struct pda_run *pdaRun, int stop )
{
if ( pdaRun->parseError )
return 0;
@@ -1146,9 +1135,9 @@ free_tree:
}
}
-void colm_pda_clear( Program *prg, Tree **sp, PdaRun *pdaRun )
+void colm_pda_clear( Program *prg, Tree **sp, struct pda_run *pdaRun )
{
- clear_fsm_run( prg, pdaRun->fsmRun );
+ clear_fsm_run( prg, pdaRun );
/* Remaining stack and parse trees underneath. */
clear_parse_tree( prg, sp, pdaRun->stackTop );
@@ -1188,21 +1177,21 @@ void colm_pda_clear( Program *prg, Tree **sp, PdaRun *pdaRun )
treeDownref( prg, sp, pdaRun->parseErrorText );
}
-void colm_pda_init( Program *prg, PdaRun *pdaRun, PdaTables *tables,
+void colm_pda_init( Program *prg, struct pda_run *pdaRun, PdaTables *tables,
int parserId, long stopTarget, int revertOn, Struct *context )
{
- memset( pdaRun, 0, sizeof(PdaRun) );
+ memset( pdaRun, 0, sizeof(struct pda_run) );
- pdaRun->tables = tables;
+ pdaRun->pda_tables = tables;
pdaRun->parserId = parserId;
pdaRun->stopTarget = stopTarget;
pdaRun->revertOn = revertOn;
pdaRun->targetSteps = -1;
- debug( prg, REALM_PARSE, "initializing PdaRun\n" );
+ debug( prg, REALM_PARSE, "initializing struct pda_run\n" );
/* FIXME: need the right one here. */
- pdaRun->cs = prg->rtd->startStates[pdaRun->parserId];
+ pdaRun->pda_cs = prg->rtd->startStates[pdaRun->parserId];
Kid *sentinal = kidAllocate( prg );
sentinal->tree = treeAllocate( prg );
@@ -1214,7 +1203,7 @@ void colm_pda_init( Program *prg, PdaRun *pdaRun, PdaTables *tables,
pdaRun->stackTop->shadow = sentinal;
pdaRun->numRetry = 0;
- pdaRun->nextRegionInd = pdaRun->tables->tokenRegionInds[pdaRun->cs];
+ pdaRun->nextRegionInd = pdaRun->pda_tables->tokenRegionInds[pdaRun->pda_cs];
pdaRun->stopParsing = false;
pdaRun->accumIgnore = 0;
pdaRun->btPoint = 0;
@@ -1239,22 +1228,21 @@ void colm_pda_init( Program *prg, PdaRun *pdaRun, PdaTables *tables,
pdaRun->rcBlockCount = 0;
- pdaRun->fsmRun = &pdaRun->_fsmRun;
- init_fsm_run( prg, pdaRun->fsmRun );
+ init_fsm_run( prg, pdaRun );
new_token( prg, pdaRun );
}
-static long stack_top_target( Program *prg, PdaRun *pdaRun )
+static long stack_top_target( Program *prg, struct pda_run *pdaRun )
{
long state;
if ( pdaRun->stackTop->state < 0 )
state = prg->rtd->startStates[pdaRun->parserId];
else {
unsigned shift = pdaRun->stackTop->id -
- pdaRun->tables->keys[pdaRun->stackTop->state<<1];
- unsigned offset = pdaRun->tables->offsets[pdaRun->stackTop->state] + shift;
- int index = pdaRun->tables->indicies[offset];
- state = pdaRun->tables->targs[index];
+ pdaRun->pda_tables->keys[pdaRun->stackTop->state<<1];
+ unsigned offset = pdaRun->pda_tables->offsets[pdaRun->stackTop->state] + shift;
+ int index = pdaRun->pda_tables->indicies[offset];
+ state = pdaRun->pda_tables->targs[index];
}
return state;
}
@@ -1289,7 +1277,7 @@ static Code *backup_over_rcode( Code *rcode )
/* The top level of the stack is linked right-to-left. Trees underneath are
* linked left-to-right. */
-static void commit_kid( Program *prg, PdaRun *pdaRun, Tree **root,
+static void commit_kid( Program *prg, struct pda_run *pdaRun, Tree **root,
ParseTree *lel, Code **rcode, long *causeReduce )
{
ParseTree *tree = 0;
@@ -1405,7 +1393,7 @@ backup:
assert( sp == root );
}
-static void commit_full( Program *prg, Tree **sp, PdaRun *pdaRun, long causeReduce )
+static void commit_full( Program *prg, Tree **sp, struct pda_run *pdaRun, long causeReduce )
{
debug( prg, REALM_PARSE, "running full commit\n" );
@@ -1436,7 +1424,7 @@ static void commit_full( Program *prg, Tree **sp, PdaRun *pdaRun, long causeRedu
* PCR_REVERSE
*/
static long parse_token( Program *prg, Tree **sp,
- PdaRun *pdaRun, StreamImpl *is, long entry )
+ struct pda_run *pdaRun, StreamImpl *is, long entry )
{
int pos;
unsigned int *action;
@@ -1455,38 +1443,38 @@ static long parse_token( Program *prg, Tree **sp,
/* This will cause parseInput to be lost. This
* path should be traced. */
- if ( pdaRun->cs < 0 )
+ if ( pdaRun->pda_cs < 0 )
return PCR_DONE;
/* Record the state in the parse tree. */
- pdaRun->parseInput->state = pdaRun->cs;
+ pdaRun->parseInput->state = pdaRun->pda_cs;
again:
if ( pdaRun->parseInput == 0 )
goto _out;
pdaRun->lel = pdaRun->parseInput;
- pdaRun->curState = pdaRun->cs;
+ pdaRun->curState = pdaRun->pda_cs;
- if ( pdaRun->lel->id < pdaRun->tables->keys[pdaRun->curState<<1] ||
- pdaRun->lel->id > pdaRun->tables->keys[(pdaRun->curState<<1)+1] )
+ if ( pdaRun->lel->id < pdaRun->pda_tables->keys[pdaRun->curState<<1] ||
+ pdaRun->lel->id > pdaRun->pda_tables->keys[(pdaRun->curState<<1)+1] )
{
debug( prg, REALM_PARSE, "parse error, no transition 1\n" );
push_bt_point( prg, pdaRun );
goto parseError;
}
- indPos = pdaRun->tables->offsets[pdaRun->curState] +
- (pdaRun->lel->id - pdaRun->tables->keys[pdaRun->curState<<1]);
+ indPos = pdaRun->pda_tables->offsets[pdaRun->curState] +
+ (pdaRun->lel->id - pdaRun->pda_tables->keys[pdaRun->curState<<1]);
- owner = pdaRun->tables->owners[indPos];
+ owner = pdaRun->pda_tables->owners[indPos];
if ( owner != pdaRun->curState ) {
debug( prg, REALM_PARSE, "parse error, no transition 2\n" );
push_bt_point( prg, pdaRun );
goto parseError;
}
- pos = pdaRun->tables->indicies[indPos];
+ pos = pdaRun->pda_tables->indicies[indPos];
if ( pos < 0 ) {
debug( prg, REALM_PARSE, "parse error, no transition 3\n" );
push_bt_point( prg, pdaRun );
@@ -1496,8 +1484,8 @@ again:
/* Checking complete. */
induceReject = false;
- pdaRun->cs = pdaRun->tables->targs[pos];
- action = pdaRun->tables->actions + pdaRun->tables->actInds[pos];
+ pdaRun->pda_cs = pdaRun->pda_tables->targs[pos];
+ action = pdaRun->pda_tables->actions + pdaRun->pda_tables->actInds[pos];
if ( pdaRun->lel->retryLower )
action += pdaRun->lel->retryLower;
@@ -1552,7 +1540,7 @@ again:
* Commit
*/
- if ( pdaRun->tables->commitLen[pos] != 0 ) {
+ if ( pdaRun->pda_tables->commitLen[pos] != 0 ) {
#if 0
long causeReduce = 0;
if ( pdaRun->parseInput != 0 ) {
@@ -1648,7 +1636,7 @@ again:
/* When the production is of zero length we stay in the same state.
* Otherwise we use the state stored in the first child. */
- pdaRun->cs = rhsLen == 0 ? pdaRun->curState : child->state;
+ pdaRun->pda_cs = rhsLen == 0 ? pdaRun->curState : child->state;
if ( prg->ctxDepParsing && prg->rtd->prodInfo[pdaRun->reduction].frameId >= 0 ) {
/* Frame info for reduction. */
@@ -1750,10 +1738,10 @@ parseError:
else if ( pdaRun->checkNext ) {
pdaRun->checkNext = false;
- if ( pdaRun->next > 0 && pdaRun->tables->tokenRegions[pdaRun->next] != 0 ) {
+ if ( pdaRun->next > 0 && pdaRun->pda_tables->tokenRegions[pdaRun->next] != 0 ) {
debug( prg, REALM_PARSE, "found a new region\n" );
pdaRun->numRetry -= 1;
- pdaRun->cs = stack_top_target( prg, pdaRun );
+ pdaRun->pda_cs = stack_top_target( prg, pdaRun );
pdaRun->nextRegionInd = pdaRun->next;
return PCR_DONE;
}
@@ -1765,7 +1753,7 @@ parseError:
debug( prg, REALM_PARSE, "stopping the backtracking, "
"steps is %d\n", pdaRun->steps );
- pdaRun->cs = stack_top_target( prg, pdaRun );
+ pdaRun->pda_cs = stack_top_target( prg, pdaRun );
goto _out;
}
}
@@ -1780,7 +1768,7 @@ parseError:
debug( prg, REALM_PARSE, "found retry targ: %p\n", pdaRun->parseInput );
pdaRun->numRetry -= 1;
- pdaRun->cs = pdaRun->parseInput->state;
+ pdaRun->pda_cs = pdaRun->parseInput->state;
goto again;
}
@@ -1976,7 +1964,7 @@ parseError:
}
fail:
- pdaRun->cs = -1;
+ pdaRun->pda_cs = -1;
pdaRun->parseError = 1;
/* FIXME: do we still need to fall through here? A fail is permanent now,
@@ -1985,7 +1973,7 @@ fail:
return PCR_DONE;
_out:
- pdaRun->nextRegionInd = pdaRun->tables->tokenRegionInds[pdaRun->cs];
+ pdaRun->nextRegionInd = pdaRun->pda_tables->tokenRegionInds[pdaRun->pda_cs];
/* COROUTINE */
case PCR_DONE:
@@ -2004,10 +1992,9 @@ _out:
* PCR_REVERSE
*/
-long colm_parse_loop( Program *prg, Tree **sp, PdaRun *pdaRun,
+long colm_parse_loop( Program *prg, Tree **sp, struct pda_run *pdaRun,
StreamImpl *is, long entry )
{
- FsmRun *fsmRun = pdaRun->fsmRun;
LangElInfo *lelInfo = prg->rtd->lelInfo;
/* COROUTINE */
@@ -2025,19 +2012,19 @@ long colm_parse_loop( Program *prg, Tree **sp, PdaRun *pdaRun,
pdaRun->tokenId = scan_token( prg, pdaRun, is );
if ( pdaRun->tokenId == SCAN_ERROR ) {
- if ( fsmRun->preRegion >= 0 ) {
- fsmRun->preRegion = -1;
- fsmRun->cs = fsmRun->ncs;
+ if ( pdaRun->preRegion >= 0 ) {
+ pdaRun->preRegion = -1;
+ pdaRun->fsm_cs = pdaRun->next_cs;
continue;
}
}
if ( pdaRun->tokenId == SCAN_ERROR &&
- ( prg->rtd->regionInfo[fsmRun->region].ciLelId > 0 ) )
+ ( prg->rtd->regionInfo[pdaRun->region].ciLelId > 0 ) )
{
debug( prg, REALM_PARSE, "sending a collect ignore\n" );
send_collect_ignore( prg, sp, pdaRun, is,
- prg->rtd->regionInfo[fsmRun->region].ciLelId );
+ prg->rtd->regionInfo[pdaRun->region].ciLelId );
goto yes;
}
@@ -2054,7 +2041,7 @@ long colm_parse_loop( Program *prg, Tree **sp, PdaRun *pdaRun,
is->eofSent = true;
send_eof( prg, sp, pdaRun, is );
- pdaRun->frameId = prg->rtd->regionInfo[fsmRun->region].eofFrameId;
+ pdaRun->frameId = prg->rtd->regionInfo[pdaRun->region].eofFrameId;
if ( prg->ctxDepParsing && pdaRun->frameId >= 0 ) {
debug( prg, REALM_PARSE, "HAVE PRE_EOF BLOCK\n" );
@@ -2106,7 +2093,7 @@ long colm_parse_loop( Program *prg, Tree **sp, PdaRun *pdaRun,
debug( prg, REALM_PARSE, "sending an named lang el\n" );
/* A named language element (parsing colm program). */
- prg->rtd->sendNamedLangEl( prg, sp, pdaRun, fsmRun, is );
+ prg->rtd->sendNamedLangEl( prg, sp, pdaRun, is );
}
else if ( pdaRun->tokenId == SCAN_TREE ) {
debug( prg, REALM_PARSE, "sending a tree\n" );
@@ -2127,14 +2114,14 @@ long colm_parse_loop( Program *prg, Tree **sp, PdaRun *pdaRun,
prg->rtd->lelInfo[pdaRun->tokenId].name );
/* Make the token data. */
- pdaRun->tokdata = peekMatch( prg, fsmRun, is );
+ pdaRun->tokdata = peekMatch( prg, pdaRun, is );
/* Note that we don't update the position now. It is done when the token
* data is pulled from the inputStream. */
- fsmRun->p = fsmRun->pe = 0;
- fsmRun->toklen = 0;
- fsmRun->eof = 0;
+ pdaRun->p = pdaRun->pe = 0;
+ pdaRun->toklen = 0;
+ pdaRun->eof = 0;
pdaRun->fi = &prg->rtd->frameInfo[prg->rtd->lelInfo[pdaRun->tokenId].frameId];
pdaRun->frameId = prg->rtd->lelInfo[pdaRun->tokenId].frameId;
@@ -2242,7 +2229,7 @@ skipSend:
}
-long colm_parse_frag( Program *prg, Tree **sp, PdaRun *pdaRun,
+long colm_parse_frag( Program *prg, Tree **sp, struct pda_run *pdaRun,
Stream *input, long stopId, long entry )
{
/* COROUTINE */
@@ -2277,7 +2264,7 @@ long colm_parse_frag( Program *prg, Tree **sp, PdaRun *pdaRun,
}
long colm_parse_finish( Tree **result, Program *prg, Tree **sp,
- PdaRun *pdaRun, Stream *input , int revertOn, long entry )
+ struct pda_run *pdaRun, Stream *input , int revertOn, long entry )
{
StreamImpl *si;
@@ -2328,7 +2315,7 @@ long colm_parse_finish( Tree **result, Program *prg, Tree **sp,
return PCR_DONE;
}
-long colm_parse_undo_frag( Program *prg, Tree **sp, PdaRun *pdaRun,
+long colm_parse_undo_frag( Program *prg, Tree **sp, struct pda_run *pdaRun,
Stream *input, long steps, long entry )
{
debug( prg, REALM_PARSE,
diff --git a/src/pdarun.h b/src/pdarun.h
index 596f75a3..b32e3c31 100644
--- a/src/pdarun.h
+++ b/src/pdarun.h
@@ -69,29 +69,6 @@ typedef struct _FsmTables
long numActionSwitch;
} FsmTables;
-typedef struct _FsmRun
-{
- FsmTables *tables;
-
- RunBuf *consumeBuf;
-
- /* FsmRun State. */
- long region, preRegion;
- long cs, ncs, act;
- char *start;
- char *tokstart;
- long tokend;
- long toklen;
- char *p, *pe;
-
- /* Bits. */
- char eof;
- char returnResult;
- char skipToklen;
-
- char *mark[MARK_SLOTS];
- long matchedToken;
-} FsmRun;
void undoStreamPull( StreamImpl *inputStream, const char *data, long length );
@@ -287,15 +264,41 @@ typedef struct _PoolAlloc
int sizeofT;
} PoolAlloc;
-typedef struct _PdaRun
+struct pda_run
{
+ /*
+ * Scanning.
+ */
+ FsmTables *fsm_tables;
+
+ RunBuf *consumeBuf;
+
+ long region, preRegion;
+ long fsm_cs, next_cs, act;
+ char *start;
+ char *tokstart;
+ long tokend;
+ long toklen;
+ char *p, *pe;
+
+ /* Bits. */
+ char eof;
+ char returnResult;
+ char skipToklen;
+
+ char *mark[MARK_SLOTS];
+ long matchedToken;
+
+ /*
+ * Parsing
+ */
int numRetry;
ParseTree *stackTop;
Ref *tokenList;
- int cs;
+ int pda_cs;
int nextRegionInd;
- PdaTables *tables;
+ PdaTables *pda_tables;
int parserId;
/* Reused. */
@@ -358,14 +361,11 @@ typedef struct _PdaRun
int rcBlockCount;
Tree *parseErrorText;
+};
- FsmRun *fsmRun;
- FsmRun _fsmRun;
-} PdaRun;
-
-void colm_pda_init( struct colm_program *prg, PdaRun *pdaRun, PdaTables *tables,
+void colm_pda_init( struct colm_program *prg, struct pda_run *pdaRun, PdaTables *tables,
int parserId, long stopTarget, int revertOn, struct colm_struct *context );
-void colm_pda_clear( struct colm_program *prg, struct colm_tree **sp, PdaRun *pdaRun );
+void colm_pda_clear( struct colm_program *prg, struct colm_tree **sp, struct pda_run *pdaRun );
void rtCodeVectReplace( RtCodeVect *vect, long pos, const Code *val, long len );
void rtCodeVectEmpty( RtCodeVect *vect );
@@ -411,22 +411,22 @@ inline static void appendWord( RtCodeVect *vect, Word word )
#endif
}
-void colm_increment_steps( PdaRun *pdaRun );
-void colm_decrement_steps( PdaRun *pdaRun );
+void colm_increment_steps( struct pda_run *pdaRun );
+void colm_decrement_steps( struct pda_run *pdaRun );
void clearStreamImpl( struct colm_program *prg, Tree **sp, StreamImpl *inputStream );
void initSourceStream( StreamImpl *in );
void clearSourceStream( struct colm_program *prg, Tree **sp, StreamImpl *sourceStream );
-void clearContext( PdaRun *pdaRun, Tree **sp );
-Kid *extractIgnore( PdaRun *pdaRun );
-void runCommit( PdaRun *pdaRun );
-void pdaRunMatch( PdaRun *pdaRun, Kid *tree, Kid *pattern );
+void clearContext( struct pda_run *pdaRun, Tree **sp );
+Kid *extractIgnore( struct pda_run *pdaRun );
+void runCommit( struct pda_run *pdaRun );
+void pdaRunMatch( struct pda_run *pdaRun, Kid *tree, Kid *pattern );
/* Offset can be used to look at the next nextRegionInd. */
-int pdaRunGetNextRegion( PdaRun *pdaRun, int offset );
-int pdaRunGetNextPreRegion( PdaRun *pdaRun );
+int pdaRunGetNextRegion( struct pda_run *pdaRun, int offset );
+int pdaRunGetNextPreRegion( struct pda_run *pdaRun );
#define PCR_START 1
#define PCR_DONE 2
@@ -436,7 +436,7 @@ int pdaRunGetNextPreRegion( PdaRun *pdaRun );
#define PCR_REVERSE 6
Head *colm_stream_pull( struct colm_program *prg, struct colm_tree **sp,
- PdaRun *pdaRun, StreamImpl *is, long length );
+ struct pda_run *pdaRun, StreamImpl *is, long length );
Head *stringAllocPointer( struct colm_program *prg, const char *data, long length );
void streamPushText( StreamImpl *inputStream, const char *data, long length );
@@ -445,25 +445,22 @@ void streamPushStream( StreamImpl *inputStream, Tree *tree );
void undoStreamPush( struct colm_program *prg, Tree **sp, StreamImpl *inputStream, long length );
void undoStreamAppend( struct colm_program *prg, Tree **sp, StreamImpl *inputStream, struct colm_tree *tree, long length );
-Kid *make_token_with_data( struct colm_program *prg, PdaRun *pdaRun,
+Kid *make_token_with_data( struct colm_program *prg, struct pda_run *pdaRun,
StreamImpl *inputStream, int id, Head *tokdata );
-void pushBinding( PdaRun *pdaRun, ParseTree *parseTree );
+void pushBinding( struct pda_run *pdaRun, ParseTree *parseTree );
-void executeGenerationAction( struct colm_program *prg, Tree **sp, FsmRun *fsmRun,
- PdaRun *pdaRun, StreamImpl *inputStream, int frameId, Code *code,
- long id, Head *tokdata );
-Kid *extractIgnore( PdaRun *pdaRun );
-long colm_parse_loop( struct colm_program *prg, Tree **sp, PdaRun *pdaRun,
+Kid *extractIgnore( struct pda_run *pdaRun );
+long colm_parse_loop( struct colm_program *prg, Tree **sp, struct pda_run *pdaRun,
StreamImpl *inputStream, long entry );
-Tree *getParsedRoot( PdaRun *pdaRun, int stop );
+Tree *getParsedRoot( struct pda_run *pdaRun, int stop );
-long colm_parse_frag( struct colm_program *prg, Tree **sp, PdaRun *pdaRun,
+long colm_parse_frag( struct colm_program *prg, Tree **sp, struct pda_run *pdaRun,
Stream *input, long stopId, long entry );
long colm_parse_finish( Tree **result, struct colm_program *prg, Tree **sp,
- PdaRun *pdaRun, Stream *input , int revertOn, long entry );
-long colm_parse_undo_frag( struct colm_program *prg, Tree **sp, PdaRun *pdaRun,
+ struct pda_run *pdaRun, Stream *input , int revertOn, long entry );
+long colm_parse_undo_frag( struct colm_program *prg, Tree **sp, struct pda_run *pdaRun,
Stream *input, long steps, long entry );
#ifdef __cplusplus
diff --git a/src/program.h b/src/program.h
index 9c9e2b00..1d244ce2 100644
--- a/src/program.h
+++ b/src/program.h
@@ -94,11 +94,11 @@ typedef struct colm_sections
long globalId;
long argvElId;
- void (*fsmExecute)( struct _FsmRun *fsmRun, struct _StreamImpl *inputStream );
- void (*sendNamedLangEl)( struct colm_program *prg, Tree **tree, struct _PdaRun *pdaRun,
- struct _FsmRun *fsmRun, struct _StreamImpl *inputStream );
- void (*initBindings)( struct _PdaRun *pdaRun );
- void (*popBinding)( struct _PdaRun *pdaRun, ParseTree *tree );
+ void (*fsmExecute)( struct pda_run *pdaRun, struct _StreamImpl *inputStream );
+ void (*sendNamedLangEl)( struct colm_program *prg, Tree **tree,
+ struct pda_run *pdaRun, struct _StreamImpl *inputStream );
+ void (*initBindings)( struct pda_run *pdaRun );
+ void (*popBinding)( struct pda_run *pdaRun, ParseTree *tree );
} RuntimeData;
diff --git a/src/struct.c b/src/struct.c
index a87ad82a..c9a916f2 100644
--- a/src/struct.c
+++ b/src/struct.c
@@ -78,7 +78,7 @@ void colm_parser_destroy( Program *prg, Tree **sp, struct colm_struct *s )
Parser *colm_parser_new( Program *prg, GenericInfo *gi )
{
- PdaRun *pdaRun = malloc( sizeof(PdaRun) );
+ struct pda_run *pdaRun = malloc( sizeof(struct pda_run) );
/* Start off the parsing process. */
colm_pda_init( prg, pdaRun, prg->rtd->pdaTables,
diff --git a/src/struct.h b/src/struct.h
index 0a6e1778..64fe82c6 100644
--- a/src/struct.h
+++ b/src/struct.h
@@ -34,7 +34,7 @@ typedef struct colm_parser
void *buffer[10];
- struct _PdaRun *pdaRun;
+ struct pda_run *pdaRun;
struct colm_stream *input;
Tree *result;
} Parser;
diff --git a/src/tree.c b/src/tree.c
index 56844922..e0400f70 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -1474,7 +1474,7 @@ Tree *getParserMem( Parser *parser, Word field )
break;
}
case 1: {
- PdaRun *pdaRun = parser->pdaRun;
+ struct pda_run *pdaRun = parser->pdaRun;
result = pdaRun->parseErrorText;
break;
}