summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--colm/bytecode.c354
-rw-r--r--colm/bytecode.h38
-rw-r--r--colm/compile.cc73
-rw-r--r--colm/declare.cc4
-rw-r--r--colm/lmparse.kh6
-rw-r--r--colm/lmparse.kl36
-rw-r--r--colm/lmscan.h6
-rw-r--r--colm/lmscan.rl2
-rw-r--r--colm/parsedata.h28
-rw-r--r--colm/parsetree.cc2
-rw-r--r--colm/parsetree.h38
-rw-r--r--colm/pdabuild.cc4
-rw-r--r--colm/pdarun.c14
-rw-r--r--colm/pool.c8
-rw-r--r--colm/pool.h4
-rw-r--r--colm/program.c2
-rw-r--r--colm/resolve.cc26
-rw-r--r--colm/tree.c50
-rw-r--r--colm/tree.h10
19 files changed, 353 insertions, 352 deletions
diff --git a/colm/bytecode.c b/colm/bytecode.c
index 0c4021b3..ed4683a2 100644
--- a/colm/bytecode.c
+++ b/colm/bytecode.c
@@ -161,9 +161,9 @@ Tree *prepParseTree( Program *prg, Tree **sp, Tree *tree )
return tree;
}
-void parserSetContext( Program *prg, Tree **sp, Accum *accum, Tree *val )
+void parserSetContext( Program *prg, Tree **sp, Parser *parser, Tree *val )
{
- accum->pdaRun->context = splitTree( prg, val );
+ parser->pdaRun->context = splitTree( prg, val );
}
Head *treeToStr( Program *prg, Tree **sp, Tree *tree )
@@ -217,15 +217,15 @@ Word streamAppend( Program *prg, Tree **sp, Tree *input, InputStream *inputStrea
return length;
}
-long parseFrag( Program *prg, Tree **sp, Accum *accum, long stopId, long entry )
+long parseFrag( Program *prg, Tree **sp, Parser *parser, long stopId, long entry )
{
switch ( entry ) {
case PcrStart:
- if ( ! accum->pdaRun->parseError ) {
- accum->pdaRun->stopTarget = stopId;
+ if ( ! parser->pdaRun->parseError ) {
+ parser->pdaRun->stopTarget = stopId;
- long pcr = parseLoop( prg, sp, accum->pdaRun, accum->fsmRun, accum->accumStream->in, entry );
+ long pcr = parseLoop( prg, sp, parser->pdaRun, parser->fsmRun, parser->input->in, entry );
while ( pcr != PcrDone ) {
@@ -240,7 +240,7 @@ case PcrRevToken2:
case PcrRevReduction:
case PcrRevReduction2:
- pcr = parseLoop( prg, sp, accum->pdaRun, accum->fsmRun, accum->accumStream->in, entry );
+ pcr = parseLoop( prg, sp, parser->pdaRun, parser->fsmRun, parser->input->in, entry );
}
}
@@ -251,16 +251,16 @@ break; }
}
long parseFinish( Tree **result, Program *prg, Tree **sp,
- Accum *accum, int revertOn, long entry )
+ Parser *parser, int revertOn, long entry )
{
switch ( entry ) {
case PcrStart:
- if ( accum->pdaRun->stopTarget <= 0 ) {
- setEof( accum->accumStream->in );
+ if ( parser->pdaRun->stopTarget <= 0 ) {
+ setEof( parser->input->in );
- if ( ! accum->pdaRun->parseError ) {
- long pcr = parseLoop( prg, sp, accum->pdaRun, accum->fsmRun, accum->accumStream->in, entry );
+ if ( ! parser->pdaRun->parseError ) {
+ long pcr = parseLoop( prg, sp, parser->pdaRun, parser->fsmRun, parser->input->in, entry );
while ( pcr != PcrDone ) {
@@ -275,15 +275,15 @@ case PcrRevToken2:
case PcrRevReduction:
case PcrRevReduction2:
- pcr = parseLoop( prg, sp, accum->pdaRun, accum->fsmRun, accum->accumStream->in, entry );
+ pcr = parseLoop( prg, sp, parser->pdaRun, parser->fsmRun, parser->input->in, entry );
}
}
}
if ( !revertOn )
- commitFull( prg, sp, accum->pdaRun, 0 );
+ commitFull( prg, sp, parser->pdaRun, 0 );
- Tree *tree = getParsedRoot( accum->pdaRun, accum->pdaRun->stopTarget > 0 );
+ Tree *tree = getParsedRoot( parser->pdaRun, parser->pdaRun->stopTarget > 0 );
treeUpref( tree );
/* Indicate that this tree came out of a parser. */
@@ -298,11 +298,11 @@ break; }
return PcrDone;
}
-long undoParseFrag( Program *prg, Tree **sp, Accum *accum, long steps, long entry )
+long undoParseFrag( Program *prg, Tree **sp, Parser *parser, long steps, long entry )
{
- InputStream *inputStream = accum->accumStream->in;
- FsmRun *fsmRun = accum->fsmRun;
- PdaRun *pdaRun = accum->pdaRun;
+ InputStream *inputStream = parser->input->in;
+ FsmRun *fsmRun = parser->fsmRun;
+ PdaRun *pdaRun = parser->pdaRun;
debug( REALM_PARSE, "undo parse frag, target steps: %ld, pdarun steps: %ld\n", steps, pdaRun->steps );
@@ -489,9 +489,9 @@ Tree *constructArgv( Program *prg, int argc, const char **argv )
* Execution environment
*/
-void initExecution( Execution *exec, Accum *accum, PdaRun *pdaRun, FsmRun *fsmRun, InputStream *inputStream, int frameId )
+void initExecution( Execution *exec, Parser *parser, PdaRun *pdaRun, FsmRun *fsmRun, InputStream *inputStream, int frameId )
{
- exec->accum = accum;
+ exec->parser = parser;
exec->pdaRun = pdaRun;
exec->fsmRun = fsmRun;
exec->inputStream = inputStream;
@@ -602,36 +602,36 @@ again:
debug( REALM_BYTECODE, "IN_STREAM_PUSH_BKT\n" );
break;
}
- case IN_ACCUM_STREAM_APPEND_BKT: {
- Tree *accum;
+ case IN_INPUT_APPEND_BKT: {
+ Tree *parser;
Tree *input;
Word len;
- read_tree( accum );
+ read_tree( parser );
read_tree( input );
read_word( len );
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_APPEND_BKT\n" );
+ debug( REALM_BYTECODE, "IN_INPUT_APPEND_BKT\n" );
- treeDownref( prg, sp, accum );
+ treeDownref( prg, sp, parser );
treeDownref( prg, sp, input );
break;
}
- case IN_ACCUM_STREAM_PULL_BKT: {
+ case IN_INPUT_PULL_BKT: {
Word f;
Tree *string;
read_tree( string );
read_word( f );
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PULL_BKT\n" );
+ debug( REALM_BYTECODE, "IN_INPUT_PULL_BKT\n" );
treeDownref( prg, sp, string );
break;
}
- case IN_ACCUM_STREAM_PUSH_BKT: {
+ case IN_INPUT_PUSH_BKT: {
Word len;
read_word( len );
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PUSH_BKT\n" );
+ debug( REALM_BYTECODE, "IN_INPUT_PUSH_BKT\n" );
break;
}
case IN_LOAD_GLOBAL_BKT: {
@@ -643,15 +643,15 @@ again:
break;
}
case IN_LOAD_ACCUM_BKT: {
- Tree *accum;
- read_tree( accum );
+ Tree *parser;
+ read_tree( parser );
debug( REALM_BYTECODE, "IN_LOAD_ACCUM_BKT\n" );
break;
}
- case IN_LOAD_ACCUM_STREAM_BKT: {
- Tree *accumStream;
- read_tree( accumStream );
- debug( REALM_BYTECODE, "IN_LOAD_ACCUM_STREAM_BKT\n" );
+ case IN_LOAD_INPUT_BKT: {
+ Tree *input;
+ read_tree( input );
+ debug( REALM_BYTECODE, "IN_LOAD_INPUT_BKT\n" );
break;
}
case IN_GET_FIELD_BKT: {
@@ -1045,21 +1045,21 @@ again:
case IN_LOAD_ACCUM_R: {
debug( REALM_BYTECODE, "IN_LOAD_ACCUM_R\n" );
- treeUpref( (Tree*)exec->accum );
- vm_push( (Tree*)exec->accum );
- assert( exec->accum != 0 );
+ treeUpref( (Tree*)exec->parser );
+ vm_push( (Tree*)exec->parser );
+ assert( exec->parser != 0 );
break;
}
case IN_LOAD_ACCUM_WV: {
debug( REALM_BYTECODE, "IN_LOAD_ACCUM_WV\n" );
- treeUpref( (Tree*)exec->accum );
- vm_push( (Tree*)exec->accum );
- assert( exec->accum != 0 );
+ treeUpref( (Tree*)exec->parser );
+ vm_push( (Tree*)exec->parser );
+ assert( exec->parser != 0 );
/* Set up the reverse instruction. */
append( &exec->pdaRun->rcodeCollect, IN_LOAD_ACCUM_BKT );
- appendWord( &exec->pdaRun->rcodeCollect, (Word)exec->accum );
+ appendWord( &exec->pdaRun->rcodeCollect, (Word)exec->parser );
exec->rcodeUnitLen = SIZEOF_CODE + SIZEOF_WORD;
break;
}
@@ -1068,57 +1068,57 @@ again:
/* This is identical to the _R version, but using it for writing
* would be confusing. */
- treeUpref( (Tree*)exec->accum );
- vm_push( (Tree*)exec->accum );
- assert( exec->accum != 0 );
+ treeUpref( (Tree*)exec->parser );
+ vm_push( (Tree*)exec->parser );
+ assert( exec->parser != 0 );
break;
}
case IN_LOAD_ACCUM_BKT: {
- Tree *accum;
- read_tree( accum );
+ Tree *parser;
+ read_tree( parser );
debug( REALM_BYTECODE, "IN_LOAD_ACCUM_BKT\n" );
- treeUpref( accum );
- vm_push( accum );
+ treeUpref( parser );
+ vm_push( parser );
break;
}
- case IN_LOAD_ACCUM_STREAM_R: {
- debug( REALM_BYTECODE, "IN_LOAD_ACCUM_STREAM_R\n" );
+ case IN_LOAD_INPUT_R: {
+ debug( REALM_BYTECODE, "IN_LOAD_INPUT_R\n" );
- assert( exec->accum != 0 );
- treeUpref( (Tree*)exec->accum->accumStream );
- vm_push( (Tree*)exec->accum->accumStream );
+ assert( exec->parser != 0 );
+ treeUpref( (Tree*)exec->parser->input );
+ vm_push( (Tree*)exec->parser->input );
break;
}
- case IN_LOAD_ACCUM_STREAM_WV: {
- debug( REALM_BYTECODE, "IN_LOAD_ACCUM_STREAM_WV\n" );
+ case IN_LOAD_INPUT_WV: {
+ debug( REALM_BYTECODE, "IN_LOAD_INPUT_WV\n" );
- assert( exec->accum != 0 );
- treeUpref( (Tree*)exec->accum->accumStream );
- vm_push( (Tree*)exec->accum->accumStream );
+ assert( exec->parser != 0 );
+ treeUpref( (Tree*)exec->parser->input );
+ vm_push( (Tree*)exec->parser->input );
/* Set up the reverse instruction. */
- append( &exec->pdaRun->rcodeCollect, IN_LOAD_ACCUM_STREAM_BKT );
- appendWord( &exec->pdaRun->rcodeCollect, (Word)exec->accum->accumStream );
+ append( &exec->pdaRun->rcodeCollect, IN_LOAD_INPUT_BKT );
+ appendWord( &exec->pdaRun->rcodeCollect, (Word)exec->parser->input );
exec->rcodeUnitLen = SIZEOF_CODE + SIZEOF_WORD;
break;
}
- case IN_LOAD_ACCUM_STREAM_WC: {
- debug( REALM_BYTECODE, "IN_LOAD_ACCUM_STREAM_WC\n" );
+ case IN_LOAD_INPUT_WC: {
+ debug( REALM_BYTECODE, "IN_LOAD_INPUT_WC\n" );
/* This is identical to the _R version, but using it for writing
* would be confusing. */
- assert( exec->accum != 0 );
- treeUpref( (Tree*)exec->accum->accumStream );
- vm_push( (Tree*)exec->accum->accumStream );
+ assert( exec->parser != 0 );
+ treeUpref( (Tree*)exec->parser->input );
+ vm_push( (Tree*)exec->parser->input );
break;
}
- case IN_LOAD_ACCUM_STREAM_BKT: {
+ case IN_LOAD_INPUT_BKT: {
Tree *accumStream;
read_tree( accumStream );
- debug( REALM_BYTECODE, "IN_LOAD_ACCUM_STREAM_BKT\n" );
+ debug( REALM_BYTECODE, "IN_LOAD_INPUT_BKT\n" );
treeUpref( accumStream );
vm_push( accumStream );
@@ -1139,7 +1139,7 @@ again:
/* Set up the reverse instruction. */
append( &exec->pdaRun->rcodeCollect, IN_LOAD_ACCUM_BKT );
- appendWord( &exec->pdaRun->rcodeCollect, (Word)exec->accum );
+ appendWord( &exec->pdaRun->rcodeCollect, (Word)exec->parser );
exec->rcodeUnitLen = SIZEOF_CODE + SIZEOF_WORD;
break;
}
@@ -2088,7 +2088,7 @@ again:
debug( REALM_BYTECODE, "IN_GET_ACCUM_CTX_R\n" );
Tree *obj = vm_pop();
- Tree *ctx = ((Accum*)obj)->pdaRun->context;
+ Tree *ctx = ((Parser*)obj)->pdaRun->context;
treeUpref( ctx );
vm_push( ctx );
treeDownref( prg, sp, obj );
@@ -2100,7 +2100,7 @@ again:
Tree *obj = vm_pop();
Tree *val = vm_pop();
- parserSetContext( prg, sp, (Accum*)obj, val );
+ parserSetContext( prg, sp, (Parser*)obj, val );
treeDownref( prg, sp, obj );
break;
}
@@ -2111,10 +2111,10 @@ again:
// case IN_SET_ACCUM_CTX_WV:
// break;
- case IN_ACCUM_STREAM_APPEND_WC: {
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_APPEND_WC \n" );
+ case IN_INPUT_APPEND_WC: {
+ debug( REALM_BYTECODE, "IN_INPUT_APPEND_WC \n" );
- AccumStream *accumStream = (AccumStream*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
Tree *input = vm_pop();
streamAppend( prg, sp, input, accumStream->in );
@@ -2122,17 +2122,17 @@ again:
treeDownref( prg, sp, input );
break;
}
- case IN_ACCUM_STREAM_APPEND_WV: {
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_APPEND_WV \n" );
+ case IN_INPUT_APPEND_WV: {
+ debug( REALM_BYTECODE, "IN_INPUT_APPEND_WV \n" );
- AccumStream *accumStream = (AccumStream*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
Tree *input = vm_pop();
Word len = streamAppend( prg, sp, input, accumStream->in );
treeUpref( (Tree*)accumStream );
vm_push( (Tree*)accumStream );
- append( &exec->pdaRun->rcodeCollect, IN_ACCUM_STREAM_APPEND_BKT );
+ append( &exec->pdaRun->rcodeCollect, IN_INPUT_APPEND_BKT );
appendWord( &exec->pdaRun->rcodeCollect, (Word) accumStream );
appendWord( &exec->pdaRun->rcodeCollect, (Word) input );
appendWord( &exec->pdaRun->rcodeCollect, (Word) len );
@@ -2140,7 +2140,7 @@ again:
break;
}
- case IN_ACCUM_STREAM_APPEND_BKT: {
+ case IN_INPUT_APPEND_BKT: {
Tree *accumStream;
Tree *input;
Word len;
@@ -2148,9 +2148,9 @@ again:
read_tree( input );
read_word( len );
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_APPEND_BKT\n" );
+ debug( REALM_BYTECODE, "IN_INPUT_APPEND_BKT\n" );
- undoStreamAppend( prg, sp, 0, ((AccumStream*)accumStream)->in, input, len );
+ undoStreamAppend( prg, sp, 0, ((Input*)accumStream)->in, input, len );
treeDownref( prg, sp, accumStream );
treeDownref( prg, sp, input );
break;
@@ -2165,11 +2165,11 @@ again:
case IN_PARSE_SAVE_STEPS: {
debug( REALM_BYTECODE, "IN_PARSE_SAVE_STEPS\n" );
- Accum *accum = (Accum*)vm_pop();
- long steps = accum->pdaRun->steps;
+ Parser *parser = (Parser*)vm_pop();
+ long steps = parser->pdaRun->steps;
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
break;
}
@@ -2177,14 +2177,14 @@ again:
debug( REALM_BYTECODE, "IN_PCR_CALL\n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
- vm_push( (SW)exec->accum );
+ vm_push( (SW)exec->parser );
vm_push( (SW)exec->pdaRun );
vm_push( (SW)exec->fsmRun );
vm_push( (SW)exec->inputStream );
@@ -2196,8 +2196,8 @@ again:
Code *returnTo = instr - ( SIZEOF_CODE + SIZEOF_CODE + SIZEOF_HALF );
vm_push( (SW)returnTo );
- initExecution( exec, accum, accum->pdaRun, accum->fsmRun, accum->accumStream->in, accum->pdaRun->frameId );
- instr = accum->pdaRun->code;
+ initExecution( exec, parser, parser->pdaRun, parser->fsmRun, parser->input->in, parser->pdaRun->frameId );
+ instr = parser->pdaRun->code;
break;
}
@@ -2212,7 +2212,7 @@ again:
exec->inputStream = ( InputStream * ) vm_pop();
exec->fsmRun = ( FsmRun * ) vm_pop();
exec->pdaRun = ( PdaRun * ) vm_pop();
- exec->accum = ( Accum * ) vm_pop();
+ exec->parser = ( Parser * ) vm_pop();
if ( instr == 0 ) {
fflush( stdout );
@@ -2233,7 +2233,7 @@ again:
exec->inputStream = ( InputStream * ) vm_pop();
exec->fsmRun = ( FsmRun * ) vm_pop();
exec->pdaRun = ( PdaRun * ) vm_pop();
- exec->accum = ( Accum * ) vm_pop();
+ exec->parser = ( Parser * ) vm_pop();
if ( instr == 0 ) {
fflush( stdout );
@@ -2250,13 +2250,13 @@ again:
read_half( stopId );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- pcr = parseFrag( prg, sp, accum, stopId, pcr );
+ pcr = parseFrag( prg, sp, parser, stopId, pcr );
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
/* If done, jump to the terminating instruction, otherwise fall
@@ -2270,10 +2270,10 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FRAG_WC3\n" );
vm_pop_ignore();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
vm_pop_ignore();
- treeDownref( prg, sp, (Tree*)accum );
+ treeDownref( prg, sp, (Tree*)parser );
if ( prg->induceExit )
goto out;
@@ -2288,13 +2288,13 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FRAG_WV\n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- pcr = parseFrag( prg, sp, accum, stopId, pcr );
+ pcr = parseFrag( prg, sp, parser, stopId, pcr );
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
/* If done, jump to the terminating instruction, otherwise fall
@@ -2308,7 +2308,7 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FRAG_WV3 \n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
debug( REALM_BYTECODE, "pcr: %ld\n", pcr );
@@ -2317,7 +2317,7 @@ again:
append( &exec->pdaRun->rcodeCollect, IN_LOAD_WORD );
appendWord( &exec->pdaRun->rcodeCollect, steps );
append( &exec->pdaRun->rcodeCollect, IN_LOAD_TREE );
- appendWord( &exec->pdaRun->rcodeCollect, (Word)accum );
+ appendWord( &exec->pdaRun->rcodeCollect, (Word)parser );
append( &exec->pdaRun->rcodeCollect, IN_PARSE_LOAD_START );
append( &exec->pdaRun->rcodeCollect, IN_PARSE_FRAG_BKT );
appendHalf( &exec->pdaRun->rcodeCollect, 0 );
@@ -2337,13 +2337,13 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FRAG_BKT\n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- pcr = undoParseFrag( prg, sp, accum, steps, pcr );
+ pcr = undoParseFrag( prg, sp, parser, steps, pcr );
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
if ( pcr == PcrDone )
@@ -2355,10 +2355,10 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FRAG_BKT3\n" );
vm_pop_ignore();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
vm_pop_ignore();
- treeDownref( prg, sp, (Tree*)accum );
+ treeDownref( prg, sp, (Tree*)parser );
break;
}
@@ -2369,14 +2369,14 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FINISH_WC\n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- accum->result = 0;
- pcr = parseFinish( &accum->result, prg, sp, accum, false, pcr );
+ parser->result = 0;
+ pcr = parseFinish( &parser->result, prg, sp, parser, false, pcr );
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
/* If done, jump to the terminating instruction, otherwise fall
@@ -2390,12 +2390,12 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FINISH_WC3\n" );
vm_pop_ignore();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
vm_pop_ignore();
- vm_push( accum->result );
- debug( REALM_BYTECODE, "accum refs: %d\n", accum->refs );
- treeDownref( prg, sp, (Tree*)accum );
+ vm_push( parser->result );
+ debug( REALM_BYTECODE, "parser refs: %d\n", parser->refs );
+ treeDownref( prg, sp, (Tree*)parser );
if ( prg->induceExit )
goto out;
@@ -2409,14 +2409,14 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FINISH_WV\n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- accum->result = 0;
- pcr = parseFinish( &accum->result, prg, sp, accum, true, pcr );
+ parser->result = 0;
+ pcr = parseFinish( &parser->result, prg, sp, parser, true, pcr );
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
if ( pcr == PcrDone )
@@ -2428,15 +2428,15 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FINISH_WV3\n" );
vm_pop_ignore();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- vm_push( accum->result );
+ vm_push( parser->result );
append( &exec->pdaRun->rcodeCollect, IN_LOAD_WORD );
appendWord( &exec->pdaRun->rcodeCollect, steps );
append( &exec->pdaRun->rcodeCollect, IN_LOAD_TREE );
- appendWord( &exec->pdaRun->rcodeCollect, (Word)accum );
+ appendWord( &exec->pdaRun->rcodeCollect, (Word)parser );
append( &exec->pdaRun->rcodeCollect, IN_PARSE_LOAD_START );
append( &exec->pdaRun->rcodeCollect, IN_PARSE_FINISH_BKT );
appendHalf( &exec->pdaRun->rcodeCollect, 0 );
@@ -2457,13 +2457,13 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FINISH_BKT\n" );
long pcr = (long)vm_pop();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
long steps = (long)vm_pop();
- pcr = undoParseFrag( prg, sp, accum, steps, pcr );
+ pcr = undoParseFrag( prg, sp, parser, steps, pcr );
vm_push( (SW)steps );
- vm_push( (SW)accum );
+ vm_push( (SW)parser );
vm_push( (SW)pcr );
if ( pcr == PcrDone )
@@ -2475,20 +2475,20 @@ again:
debug( REALM_BYTECODE, "IN_PARSE_FINISH_BKT3\n" );
vm_pop_ignore();
- Accum *accum = (Accum*)vm_pop();
+ Parser *parser = (Parser*)vm_pop();
vm_pop_ignore();
- unsetEof( accum->accumStream->in );
- treeDownref( prg, sp, (Tree*)accum );
+ unsetEof( parser->input->in );
+ treeDownref( prg, sp, (Tree*)parser );
break;
}
case IN_STREAM_PULL: {
debug( REALM_BYTECODE, "IN_STREAM_PULL\n" );
- Tree *accum = vm_pop();
+ Tree *parser = vm_pop();
Tree *len = vm_pop();
- Tree *string = streamPullBc( prg, exec->fsmRun, ((Accum*)accum)->accumStream->in, len );
+ Tree *string = streamPullBc( prg, exec->fsmRun, ((Parser*)parser)->input->in, len );
treeUpref( string );
vm_push( string );
@@ -2499,7 +2499,7 @@ again:
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
append( &exec->pdaRun->rcodeCollect, exec->rcodeUnitLen );
- treeDownref( prg, sp, accum );
+ treeDownref( prg, sp, parser );
treeDownref( prg, sp, len );
break;
}
@@ -2507,21 +2507,21 @@ again:
Tree *string;
read_tree( string );
- Tree *accum = vm_pop();
+ Tree *parser = vm_pop();
debug( REALM_BYTECODE, "IN_STREAM_PULL_BKT\n" );
- //undoPull( prg, ((Accum*)accum)->fsmRun, ((Accum*)accum)->in, string );
- treeDownref( prg, sp, accum );
+ //undoPull( prg, ((Parser*)parser)->fsmRun, ((Parser*)parser)->in, string );
+ treeDownref( prg, sp, parser );
treeDownref( prg, sp, string );
break;
}
case IN_STREAM_PUSH_WV: {
debug( REALM_BYTECODE, "IN_STREAM_PUSH_WV\n" );
- Tree *accum = vm_pop();
+ Tree *parser = vm_pop();
Tree *tree = vm_pop();
- int len = streamPush( prg, sp, ((Accum*)accum)->fsmRun, ((Accum*)accum)->accumStream->in, tree, false );
+ int len = streamPush( prg, sp, ((Parser*)parser)->fsmRun, ((Parser*)parser)->input->in, tree, false );
vm_push( 0 );
/* Single unit. */
@@ -2530,16 +2530,16 @@ again:
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
append( &exec->pdaRun->rcodeCollect, exec->rcodeUnitLen );
- treeDownref( prg, sp, accum );
+ treeDownref( prg, sp, parser );
treeDownref( prg, sp, tree );
break;
}
case IN_STREAM_PUSH_IGNORE_WV: {
debug( REALM_BYTECODE, "IN_STREAM_PUSH_IGNORE_WV\n" );
- Tree *accum = vm_pop();
+ Tree *parser = vm_pop();
Tree *tree = vm_pop();
- long len = streamPush( prg, sp, ((Accum*)accum)->fsmRun, ((Accum*)accum)->accumStream->in, tree, true );
+ long len = streamPush( prg, sp, ((Parser*)parser)->fsmRun, ((Parser*)parser)->input->in, tree, true );
vm_push( 0 );
/* Single unit. */
@@ -2548,7 +2548,7 @@ again:
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
append( &exec->pdaRun->rcodeCollect, exec->rcodeUnitLen );
- treeDownref( prg, sp, accum );
+ treeDownref( prg, sp, parser );
treeDownref( prg, sp, tree );
break;
}
@@ -2556,18 +2556,18 @@ again:
Word len;
read_word( len );
- Tree *accum = vm_pop();
+ Tree *parser = vm_pop();
debug( REALM_BYTECODE, "IN_STREAM_PUSH_BKT\n" );
- undoStreamPush( prg, sp, ((Accum*)accum)->fsmRun, ((Accum*)accum)->accumStream->in, len );
- treeDownref( prg, sp, accum );
+ undoStreamPush( prg, sp, ((Parser*)parser)->fsmRun, ((Parser*)parser)->input->in, len );
+ treeDownref( prg, sp, parser );
break;
}
- case IN_ACCUM_STREAM_PULL: {
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PULL\n" );
+ case IN_INPUT_PULL: {
+ debug( REALM_BYTECODE, "IN_INPUT_PULL\n" );
- AccumStream *accumStream = (AccumStream*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
Tree *len = vm_pop();
Tree *string = streamPullBc( prg, exec->fsmRun, accumStream->in, len );
treeUpref( string );
@@ -2575,7 +2575,7 @@ again:
/* Single unit. */
treeUpref( string );
- append( &exec->pdaRun->rcodeCollect, IN_ACCUM_STREAM_PULL_BKT );
+ append( &exec->pdaRun->rcodeCollect, IN_INPUT_PULL_BKT );
appendWord( &exec->pdaRun->rcodeCollect, (Word) string );
appendWord( &exec->pdaRun->rcodeCollect, (Word) exec->fsmRun );
exec->rcodeUnitLen += SIZEOF_CODE + 2 *SIZEOF_WORD;
@@ -2585,7 +2585,7 @@ again:
treeDownref( prg, sp, len );
break;
}
- case IN_ACCUM_STREAM_PULL_BKT: {
+ case IN_INPUT_PULL_BKT: {
Word f;
Tree *string;
read_tree( string );
@@ -2594,23 +2594,23 @@ again:
Tree *accumStream = vm_pop();
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PULL_BKT\n" );
+ debug( REALM_BYTECODE, "IN_INPUT_PULL_BKT\n" );
- undoPull( prg, fsmRun, ((AccumStream*)accumStream)->in, string );
+ undoPull( prg, fsmRun, ((Input*)accumStream)->in, string );
treeDownref( prg, sp, accumStream );
treeDownref( prg, sp, string );
break;
}
- case IN_ACCUM_STREAM_PUSH_WV: {
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PUSH_WV\n" );
+ case IN_INPUT_PUSH_WV: {
+ debug( REALM_BYTECODE, "IN_INPUT_PUSH_WV\n" );
- AccumStream *accumStream = (AccumStream*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
Tree *tree = vm_pop();
long len = streamPush( prg, sp, 0, accumStream->in, tree, false );
vm_push( 0 );
/* Single unit. */
- append( &exec->pdaRun->rcodeCollect, IN_ACCUM_STREAM_PUSH_BKT );
+ append( &exec->pdaRun->rcodeCollect, IN_INPUT_PUSH_BKT );
appendWord( &exec->pdaRun->rcodeCollect, len );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
append( &exec->pdaRun->rcodeCollect, exec->rcodeUnitLen );
@@ -2619,16 +2619,16 @@ again:
treeDownref( prg, sp, tree );
break;
}
- case IN_ACCUM_STREAM_PUSH_IGNORE_WV: {
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PUSH_IGNORE_WV\n" );
+ case IN_INPUT_PUSH_IGNORE_WV: {
+ debug( REALM_BYTECODE, "IN_INPUT_PUSH_IGNORE_WV\n" );
- AccumStream *accumStream = (AccumStream*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
Tree *tree = vm_pop();
long len = streamPush( prg, sp, 0, accumStream->in, tree, true );
vm_push( 0 );
/* Single unit. */
- append( &exec->pdaRun->rcodeCollect, IN_ACCUM_STREAM_PUSH_BKT );
+ append( &exec->pdaRun->rcodeCollect, IN_INPUT_PUSH_BKT );
appendWord( &exec->pdaRun->rcodeCollect, len );
exec->rcodeUnitLen += SIZEOF_CODE + SIZEOF_WORD;
append( &exec->pdaRun->rcodeCollect, exec->rcodeUnitLen );
@@ -2637,13 +2637,13 @@ again:
treeDownref( prg, sp, tree );
break;
}
- case IN_ACCUM_STREAM_PUSH_BKT: {
+ case IN_INPUT_PUSH_BKT: {
Word len;
read_word( len );
- AccumStream *accumStream = (AccumStream*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
- debug( REALM_BYTECODE, "IN_ACCUM_STREAM_PUSH_BKT\n" );
+ debug( REALM_BYTECODE, "IN_INPUT_PUSH_BKT\n" );
undoStreamPush( prg, sp, 0, accumStream->in, len );
treeDownref( prg, sp, (Tree*)accumStream );
@@ -2683,35 +2683,35 @@ again:
vm_push( replTree );
break;
}
- case IN_CONS_ACCUM_STREAM: {
- debug( REALM_BYTECODE, "IN_CONS_ACCUM_STREAM\n" );
+ case IN_CONS_INPUT: {
+ debug( REALM_BYTECODE, "IN_CONS_INPUT\n" );
- AccumStream *accumStream = accumStreamAllocate( prg );
+ Input *accumStream = accumStreamAllocate( prg );
accumStream->refs = 1;
- accumStream->id = LEL_ID_ACCUM_STREAM;
+ accumStream->id = LEL_ID_INPUT;
accumStream->in = malloc( sizeof(InputStream) );
initInputStream( accumStream->in );
vm_push( (Tree*) accumStream );
break;
}
- case IN_GET_ACCUM_STREAM: {
- debug( REALM_BYTECODE, "IN_GET_ACCUM_STREAM\n" );
+ case IN_GET_INPUT: {
+ debug( REALM_BYTECODE, "IN_GET_INPUT\n" );
- Accum *accum = (Accum*)vm_pop();
- treeUpref( (Tree*)accum->accumStream );
- vm_push( (Tree*)accum->accumStream );
- treeDownref( prg, sp, (Tree*)accum );
+ Parser *parser = (Parser*)vm_pop();
+ treeUpref( (Tree*)parser->input );
+ vm_push( (Tree*)parser->input );
+ treeDownref( prg, sp, (Tree*)parser );
break;
}
- case IN_SET_ACCUM_STREAM: {
- debug( REALM_BYTECODE, "IN_SET_ACCUM_STREAM\n" );
+ case IN_SET_INPUT: {
+ debug( REALM_BYTECODE, "IN_SET_INPUT\n" );
- Accum *accum = (Accum*)vm_pop();
- AccumStream *accumStream = (AccumStream*)vm_pop();
- accum->accumStream = accumStream;
+ Parser *parser = (Parser*)vm_pop();
+ Input *accumStream = (Input*)vm_pop();
+ parser->input = accumStream;
treeUpref( (Tree*)accumStream );
- treeDownref( prg, sp, (Tree*)accum );
+ treeDownref( prg, sp, (Tree*)parser );
treeDownref( prg, sp, (Tree*)accumStream );
break;
}
diff --git a/colm/bytecode.h b/colm/bytecode.h
index 2b64bf1a..2d73dafc 100644
--- a/colm/bytecode.h
+++ b/colm/bytecode.h
@@ -222,8 +222,8 @@ typedef unsigned char uchar;
#define IN_STREAM_PULL 0x94
#define IN_STREAM_PULL_BKT 0x95
-#define IN_ACCUM_STREAM_PULL 0xf7
-#define IN_ACCUM_STREAM_PULL_BKT 0xf8
+#define IN_INPUT_PULL 0xf7
+#define IN_INPUT_PULL_BKT 0xf8
#define IN_PARSE_LOAD_START 0xf2
#define IN_PARSE_SAVE_STEPS 0xf3
@@ -236,9 +236,9 @@ typedef unsigned char uchar;
#define IN_PARSE_FRAG_BKT 0xc2
#define IN_PARSE_FRAG_BKT3 0xe6
-#define IN_ACCUM_STREAM_APPEND_WC 0x91
-#define IN_ACCUM_STREAM_APPEND_WV 0x92
-#define IN_ACCUM_STREAM_APPEND_BKT 0x93
+#define IN_INPUT_APPEND_WC 0x91
+#define IN_INPUT_APPEND_WV 0x92
+#define IN_INPUT_APPEND_BKT 0x93
#define IN_PARSE_FINISH_WC 0x9d
#define IN_PARSE_FINISH_WC3 0xea
@@ -274,14 +274,14 @@ typedef unsigned char uchar;
#define IN_LOAD_ACCUM_WC 0xaa
#define IN_LOAD_ACCUM_BKT 0xab
-#define IN_LOAD_ACCUM_STREAM_R 0x98
-#define IN_LOAD_ACCUM_STREAM_WV 0x99
-#define IN_LOAD_ACCUM_STREAM_WC 0x9a
-#define IN_LOAD_ACCUM_STREAM_BKT 0x9b
+#define IN_LOAD_INPUT_R 0x98
+#define IN_LOAD_INPUT_WV 0x99
+#define IN_LOAD_INPUT_WC 0x9a
+#define IN_LOAD_INPUT_BKT 0x9b
-#define IN_ACCUM_STREAM_PUSH_WV 0xf9
-#define IN_ACCUM_STREAM_PUSH_BKT 0xfa
-#define IN_ACCUM_STREAM_PUSH_IGNORE_WV 0xfb
+#define IN_INPUT_PUSH_WV 0xf9
+#define IN_INPUT_PUSH_BKT 0xfa
+#define IN_INPUT_PUSH_IGNORE_WV 0xfb
#define IN_LOAD_CONTEXT_R 0xac
#define IN_LOAD_CONTEXT_WV 0xad
@@ -309,9 +309,9 @@ typedef unsigned char uchar;
#define IN_SET_RHS_VAL_WV 0xd6
#define IN_SET_RHS_VAL_BKT 0xd7
-#define IN_CONS_ACCUM_STREAM 0x9c
-#define IN_SET_ACCUM_STREAM 0xa7
-#define IN_GET_ACCUM_STREAM 0xb9
+#define IN_CONS_INPUT 0x9c
+#define IN_SET_INPUT 0xa7
+#define IN_GET_INPUT 0xb9
/* Types */
#define TYPE_NIL 0x01
@@ -337,8 +337,8 @@ typedef unsigned char uchar;
#define LEL_ID_INT 3
#define LEL_ID_STR 4
#define LEL_ID_STREAM 5
-#define LEL_ID_ACCUM_STREAM 6
-#define LEL_ID_IGNORE_LIST 7
+#define LEL_ID_INPUT 6
+#define LEL_ID_IGNORE 7
/*
* Flags
@@ -437,7 +437,7 @@ typedef Tree **StackPtr;
typedef struct _Execution
{
- Accum *accum;
+ Parser *parser;
PdaRun *pdaRun;
FsmRun *fsmRun;
InputStream *inputStream;
@@ -467,7 +467,7 @@ Head *intToStr( struct ColmProgram *prg, Word i );
Tree *constructString( struct ColmProgram *prg, Head *s );
-void initExecution( Execution *exec, Accum *accum, PdaRun *pdaRun, FsmRun *fsmRun, InputStream *inputStream, int frameId );
+void initExecution( Execution *exec, Parser *parser, PdaRun *pdaRun, FsmRun *fsmRun, InputStream *inputStream, int frameId );
void mainExecution( struct ColmProgram *prg, Execution *exec, Code *code );
void reductionExecution( Execution *exec, Tree **sp );
diff --git a/colm/compile.cc b/colm/compile.cc
index 7da25c02..7ead937a 100644
--- a/colm/compile.cc
+++ b/colm/compile.cc
@@ -39,8 +39,8 @@ void ParseData::initUniqueTypes( )
uniqueTypeInt = new UniqueType( TYPE_TREE, intLangEl );
uniqueTypeStr = new UniqueType( TYPE_TREE, strLangEl );
uniqueTypeStream = new UniqueType( TYPE_TREE, streamLangEl );
- uniqueTypeAccumStream = new UniqueType( TYPE_TREE, accumStreamLangEl );
- uniqueTypeIgnoreList = new UniqueType( TYPE_TREE, ignoreListLangEl );
+ uniqueTypeInput = new UniqueType( TYPE_TREE, inputLangEl );
+ uniqueTypeIgnore = new UniqueType( TYPE_TREE, ignoreLangEl );
uniqueTypeAny = new UniqueType( TYPE_TREE, anyLangEl );
uniqeTypeMap.insert( uniqueTypeNil );
@@ -49,7 +49,8 @@ void ParseData::initUniqueTypes( )
uniqeTypeMap.insert( uniqueTypeInt );
uniqeTypeMap.insert( uniqueTypeStr );
uniqeTypeMap.insert( uniqueTypeStream );
- uniqeTypeMap.insert( uniqueTypeIgnoreList );
+ uniqeTypeMap.insert( uniqueTypeInput );
+ uniqeTypeMap.insert( uniqueTypeIgnore );
uniqeTypeMap.insert( uniqueTypeAny );
}
@@ -1264,11 +1265,11 @@ UniqueType *LangTerm::evaluateConstruct( ParseData *pd, CodeVect &code ) const
if ( replUT->typeId != TYPE_TREE )
error(loc) << "don't know how to construct this type" << endp;
- if ( typeRef->type == TypeRef::Accum ) {
- code.append( IN_CONS_ACCUM_STREAM );
+ if ( typeRef->type == TypeRef::Parser ) {
+ code.append( IN_CONS_INPUT );
code.append( IN_DUP_TOP_OFF );
code.appendHalf( 1 );
- code.append( IN_SET_ACCUM_STREAM );
+ code.append( IN_SET_INPUT );
}
replacement->langEl = replUT->langEl;
@@ -1361,17 +1362,17 @@ UniqueType *LangTerm::evaluateParse( ParseData *pd, CodeVect &code, bool stop )
if ( stop )
ut->langEl->parseStop = true;
- if ( argUT != pd->uniqueTypeAccumStream ) {
- code.append( IN_CONS_ACCUM_STREAM );
+ if ( argUT != pd->uniqueTypeInput ) {
+ code.append( IN_CONS_INPUT );
if ( pd->revertOn )
- code.append( IN_ACCUM_STREAM_APPEND_WV );
+ code.append( IN_INPUT_APPEND_WV );
else
- code.append( IN_ACCUM_STREAM_APPEND_WC );
+ code.append( IN_INPUT_APPEND_WC );
}
code.append( IN_DUP_TOP_OFF );
code.appendHalf( 1 );
- code.append( IN_SET_ACCUM_STREAM );
+ code.append( IN_SET_INPUT );
int stopId = stop ? ut->langEl->id : 0;
@@ -2033,12 +2034,12 @@ void LangStmt::compileWhile( ParseData *pd, CodeVect &code ) const
pd->curLocalFrame->iterPopScope();
}
-void LangStmt::evaluateAccumItems( ParseData *pd, CodeVect &code ) const
+void LangStmt::evaluateParserItems( ParseData *pd, CodeVect &code ) const
{
varRef->evaluate( pd, code );
/* Assign bind ids to the variables in the replacement. */
- for ( ReplItemList::Iter item = *accumText->list; item.lte(); item++ ) {
+ for ( ReplItemList::Iter item = *parserText->list; item.lte(); item++ ) {
UniqueType *exprUT = 0;
switch ( item->type ) {
case ReplItem::FactorType: {
@@ -2078,11 +2079,11 @@ void LangStmt::evaluateAccumItems( ParseData *pd, CodeVect &code ) const
code.appendHalf( 1 );
/* Not a stream. Get the input first. */
- code.append( IN_GET_ACCUM_STREAM );
+ code.append( IN_GET_INPUT );
if ( pd->revertOn )
- code.append( IN_ACCUM_STREAM_APPEND_WV );
+ code.append( IN_INPUT_APPEND_WV );
else
- code.append( IN_ACCUM_STREAM_APPEND_WC );
+ code.append( IN_INPUT_APPEND_WC );
code.append( IN_POP );
code.append( IN_DUP_TOP );
@@ -2270,8 +2271,8 @@ void LangStmt::compile( ParseData *pd, CodeVect &code ) const
objField->refActive = false;
break;
}
- case AccumType: {
- evaluateAccumItems( pd, code );
+ case ParserType: {
+ evaluateParserItems( pd, code );
break;
}
}
@@ -2316,7 +2317,7 @@ void ParseData::addMatchText( ObjectDef *frame, LangEl *lel )
void ParseData::addInput( ObjectDef *frame )
{
/* Make the type ref. */
- TypeRef *typeRef = new TypeRef( InputLoc(), uniqueTypeAccumStream );
+ TypeRef *typeRef = new TypeRef( InputLoc(), uniqueTypeInput );
/* Create the field and insert it into the map. */
ObjField *el = new ObjField( InputLoc(), typeRef, "input" );
@@ -2325,9 +2326,9 @@ void ParseData::addInput( ObjectDef *frame )
el->isConst = false;
el->useOffset = false;
el->isCustom = true;
- el->inGetR = IN_LOAD_ACCUM_STREAM_R;
- el->inGetWV = IN_LOAD_ACCUM_STREAM_WV;
- el->inGetWC = IN_LOAD_ACCUM_STREAM_WC;
+ el->inGetR = IN_LOAD_INPUT_R;
+ el->inGetWV = IN_LOAD_INPUT_WV;
+ el->inGetWC = IN_LOAD_INPUT_WC;
frame->insertField( el->name, el );
}
@@ -2428,18 +2429,18 @@ void ParseData::initStreamObject( )
IN_STREAM_PUSH_IGNORE_WV, IN_STREAM_PUSH_IGNORE_WV, uniqueTypeAny, false );
}
-void ParseData::initAccumStreamObject( )
+void ParseData::initInputObject( )
{
- accumStreamObj = new ObjectDef( ObjectDef::BuiltinType,
+ inputObj = new ObjectDef( ObjectDef::BuiltinType,
"accum_stream", nextObjectId++ );
- accumStreamLangEl->objectDef = accumStreamObj;
+ inputLangEl->objectDef = inputObj;
- initFunction( uniqueTypeStr, accumStreamObj, "pull",
- IN_ACCUM_STREAM_PULL, IN_ACCUM_STREAM_PULL, uniqueTypeInt, false );
- initFunction( uniqueTypeStr, accumStreamObj, "push",
- IN_ACCUM_STREAM_PUSH_WV, IN_ACCUM_STREAM_PUSH_WV, uniqueTypeAny, false );
- initFunction( uniqueTypeStr, accumStreamObj, "push_ignore",
- IN_ACCUM_STREAM_PUSH_IGNORE_WV, IN_ACCUM_STREAM_PUSH_IGNORE_WV, uniqueTypeAny, false );
+ initFunction( uniqueTypeStr, inputObj, "pull",
+ IN_INPUT_PULL, IN_INPUT_PULL, uniqueTypeInt, false );
+ initFunction( uniqueTypeStr, inputObj, "push",
+ IN_INPUT_PUSH_WV, IN_INPUT_PUSH_WV, uniqueTypeAny, false );
+ initFunction( uniqueTypeStr, inputObj, "push_ignore",
+ IN_INPUT_PUSH_IGNORE_WV, IN_INPUT_PUSH_IGNORE_WV, uniqueTypeAny, false );
}
ObjField *ParseData::makeDataEl()
@@ -2789,7 +2790,7 @@ void ParseData::initVectorFunctions( GenericType *gen )
IN_VECTOR_INSERT_WV, IN_VECTOR_INSERT_WC, uniqueTypeInt, gen->utArg, false );
}
-void ParseData::initAccumFunctions( GenericType *gen )
+void ParseData::initParserFunctions( GenericType *gen )
{
initFunction( gen->utArg, gen->objDef, "finish",
IN_PARSE_FINISH_WV, IN_PARSE_FINISH_WC, true );
@@ -2818,7 +2819,7 @@ void ParseData::initCtxField( GenericType *gen )
el->beenInitialized = true;
}
-void ParseData::initAccumFields( GenericType *gen )
+void ParseData::initParserFields( GenericType *gen )
{
LangEl *langEl = gen->utArg->langEl;
if ( langEl->contextIn != 0 )
@@ -2851,8 +2852,8 @@ void ParseData::initGenericTypes()
case GEN_PARSER:
/* Need to generate a parser for the type. */
gen->utArg->langEl->parserId = nextParserId++;
- initAccumFunctions( gen );
- initAccumFields( gen );
+ initParserFunctions( gen );
+ initParserFields( gen );
break;
}
@@ -3212,7 +3213,7 @@ void ParseData::compileByteCode()
initIntObject();
initStrObject();
initStreamObject();
- initAccumStreamObject();
+ initInputObject();
initTokenObjects();
makeDefaultIterators();
initAllLanguageObjects();
diff --git a/colm/declare.cc b/colm/declare.cc
index 546f2601..a50ebcb3 100644
--- a/colm/declare.cc
+++ b/colm/declare.cc
@@ -96,8 +96,8 @@ void ParseData::declareBaseLangEls()
intLangEl = declareLangEl( this, rootNamespace, "int", LangEl::Term );
strLangEl = declareLangEl( this, rootNamespace, "str", LangEl::Term );
streamLangEl = declareLangEl( this, rootNamespace, "stream", LangEl::Term );
- accumStreamLangEl = declareLangEl( this, rootNamespace, "accum_stream", LangEl::Term );
- ignoreListLangEl = declareLangEl( this, rootNamespace, "il", LangEl::Term );
+ inputLangEl = declareLangEl( this, rootNamespace, "accum_stream", LangEl::Term );
+ ignoreLangEl = declareLangEl( this, rootNamespace, "il", LangEl::Term );
/* Make the EOF language element. */
eofLangEl = 0;
diff --git a/colm/lmparse.kh b/colm/lmparse.kh
index 4749998d..529dfcc6 100644
--- a/colm/lmparse.kh
+++ b/colm/lmparse.kh
@@ -28,10 +28,10 @@
#define PROPERTY_REDUCE_FIRST 0x1
-struct Parser
+struct ColmParser
{
%%{
- parser Parser;
+ parser ColmParser;
# Use a class for tokens.
token uses class Token;
@@ -71,7 +71,7 @@ struct Parser
void init();
int parseLangEl( int type, const Token *token );
- Parser( const char *fileName, const char *sectionName, const InputLoc &sectionLoc )
+ ColmParser( const char *fileName, const char *sectionName, const InputLoc &sectionLoc )
: sectionName(sectionName), enterRl(false)
{
pd = new ParseData( fileName, sectionName, sectionLoc, std::cout );
diff --git a/colm/lmparse.kl b/colm/lmparse.kl
index 7ab0a7da..e3014212 100644
--- a/colm/lmparse.kl
+++ b/colm/lmparse.kl
@@ -36,7 +36,7 @@ ParserDict parserDict;
%%{
-parser Parser;
+parser ColmParser;
include "lmparse.kh";
@@ -439,7 +439,7 @@ type_ref: KW_Accum '<' type_ref '>'
final {
NamespaceQual *nspaceQual = new NamespaceQual(
namespaceStack.top(), regionStack.top() );
- $$->typeRef = new TypeRef( TypeRef::Accum, InputLoc(), nspaceQual, $3->typeRef, 0 );
+ $$->typeRef = new TypeRef( TypeRef::Parser, InputLoc(), nspaceQual, $3->typeRef, 0 );
};
nonterm basic_type_ref uses type_ref;
@@ -1326,19 +1326,19 @@ statement: var_ref TK_LtLt accumulate
final {
Namespace *nspace = namespaceStack.top();
TokenRegion *region = regionStack.top();
- AccumText *accumText = new AccumText( $2->loc, nspace, region, replItemList );
- pd->accumTextList.append( accumText );
+ ParserText *parserText = new ParserText( $2->loc, nspace, region, replItemList );
+ pd->parserTextList.append( parserText );
- $$->stmt = new LangStmt( LangStmt::AccumType, $1->varRef, accumText );
+ $$->stmt = new LangStmt( LangStmt::ParserType, $1->varRef, parserText );
};
statement: KW_Send var_ref accumulate
final {
Namespace *nspace = namespaceStack.top();
TokenRegion *region = regionStack.top();
- AccumText *accumText = new AccumText( $1->loc, nspace, region, replItemList );
- pd->accumTextList.append( accumText );
+ ParserText *parserText = new ParserText( $1->loc, nspace, region, replItemList );
+ pd->parserTextList.append( parserText );
- $$->stmt = new LangStmt( LangStmt::AccumType, $2->varRef, accumText );
+ $$->stmt = new LangStmt( LangStmt::ParserType, $2->varRef, parserText );
};
nonterm opt_require_stmt uses statement;
@@ -1741,7 +1741,7 @@ code_factor: KW_Parse opt_capture type_ref '(' opt_code_expr_list ')'
NamespaceQual *nspaceQual = new NamespaceQual(
namespaceStack.top(), regionStack.top() );
- TypeRef *parserTypeRef = new TypeRef( TypeRef::Accum,
+ TypeRef *parserTypeRef = new TypeRef( TypeRef::Parser,
InputLoc(), nspaceQual, $3->typeRef, 0 );
Replacement *replacement = new Replacement( $1->loc, nspace, pd->rootRegion,
@@ -1780,7 +1780,7 @@ code_factor: KW_ParseStop opt_capture type_ref '(' opt_code_expr_list ')'
NamespaceQual *nspaceQual = new NamespaceQual(
namespaceStack.top(), regionStack.top() );
- TypeRef *parserTypeRef = new TypeRef( TypeRef::Accum,
+ TypeRef *parserTypeRef = new TypeRef( TypeRef::Parser,
InputLoc(), nspaceQual, $3->typeRef, 0 );
Replacement *replacement = new Replacement( $1->loc, nspace, pd->rootRegion,
@@ -2400,7 +2400,7 @@ opt_commit: KW_Commit final { $$->commit = true; };
write data;
}%%
-void Parser::init()
+void ColmParser::init()
{
/* Set up the root namespace. */
const char *rootNamespaceName = "___ROOT_NAMESPACE";
@@ -2443,7 +2443,7 @@ void Parser::init()
addArgvList();
}
-void Parser::addArgvList()
+void ColmParser::addArgvList()
{
NamespaceQual *nspaceQual1 = new NamespaceQual(
namespaceStack.top(), regionStack.top() );
@@ -2456,13 +2456,13 @@ void Parser::addArgvList()
nspaceQual2, typeRef, 0 );
}
-int Parser::parseLangEl( int type, const Token *token )
+int ColmParser::parseLangEl( int type, const Token *token )
{
%% write exec;
return errCount == 0 ? 0 : -1;
}
-void Parser::addRegularDef( const InputLoc &loc, Namespace *nspace,
+void ColmParser::addRegularDef( const InputLoc &loc, Namespace *nspace,
const String &name, JoinOrLm *joinOrLm, bool isInstance )
{
GraphDictEl *newEl = nspace->graphDict.insert( name );
@@ -2482,7 +2482,7 @@ void Parser::addRegularDef( const InputLoc &loc, Namespace *nspace,
}
}
-ostream &Parser::parse_error( int tokId, Token &token )
+ostream &ColmParser::parse_error( int tokId, Token &token )
{
/* Maintain the error count. */
gblErrorCount += 1;
@@ -2490,9 +2490,9 @@ ostream &Parser::parse_error( int tokId, Token &token )
cerr << token.loc.fileName << ":" << token.loc.line << ":" << token.loc.col << ": ";
cerr << "at token ";
if ( tokId < 128 )
- cerr << "\"" << Parser_lelNames[tokId] << "\"";
+ cerr << "\"" << ColmParser_lelNames[tokId] << "\"";
else
- cerr << Parser_lelNames[tokId];
+ cerr << ColmParser_lelNames[tokId];
if ( token.data != 0 )
cerr << " with data \"" << token.data << "\"";
cerr << ": ";
@@ -2500,7 +2500,7 @@ ostream &Parser::parse_error( int tokId, Token &token )
return cerr;
}
-int Parser::token( InputLoc &loc, int tokId, char *tokstart, int toklen )
+int ColmParser::token( InputLoc &loc, int tokId, char *tokstart, int toklen )
{
Token token;
diff --git a/colm/lmscan.h b/colm/lmscan.h
index 4e349301..7b232624 100644
--- a/colm/lmscan.h
+++ b/colm/lmscan.h
@@ -60,7 +60,7 @@ extern ArgsVector includePaths;
struct Scanner
{
Scanner( const char *fileName, istream &input,
- ostream &output, Parser *includeToParser, int includeDepth )
+ ostream &output, ColmParser *includeToParser, int includeDepth )
:
fileName(fileName), input(input), output(output),
includeDepth(includeDepth),
@@ -71,7 +71,7 @@ struct Scanner
if ( includeToParser != 0 )
parser = includeToParser;
else {
- parser = new Parser( fileName, "machine", InputLoc() );
+ parser = new ColmParser( fileName, "machine", InputLoc() );
parser->init();
}
}
@@ -106,7 +106,7 @@ struct Scanner
/* Set by machine statements, these persist from section to section
* allowing for unnamed sections. */
- Parser *parser;
+ ColmParser *parser;
IncludeStack includeStack;
/* This is set if ragel has already emitted an error stating that
diff --git a/colm/lmscan.rl b/colm/lmscan.rl
index ef23ce36..3e1c0e01 100644
--- a/colm/lmscan.rl
+++ b/colm/lmscan.rl
@@ -628,5 +628,5 @@ void Scanner::eof()
loc.fileName = "<EOF>";
loc.line = line;
loc.col = 1;
- parser->token( loc, Parser_tk_eof, 0, 0 );
+ parser->token( loc, ColmParser_tk_eof, 0, 0 );
}
diff --git a/colm/parsedata.h b/colm/parsedata.h
index a19aff1e..917b1f88 100644
--- a/colm/parsedata.h
+++ b/colm/parsedata.h
@@ -750,7 +750,7 @@ struct ParseData
void resolveProductionEls();
void resolvePatternEls();
void resolveReplacementEls();
- void resolveAccumEls();
+ void resolveParserEls();
void addMatchText( ObjectDef *frame, LangEl *lel );
void addMatchLength( ObjectDef *frame, LangEl *lel );
@@ -790,8 +790,8 @@ struct ParseData
void initListFields( GenericType *gen );
void initListFunctions( GenericType *gen );
void initVectorFunctions( GenericType *gen );
- void initAccumFunctions( GenericType *gen );
- void initAccumFields( GenericType *gen );
+ void initParserFunctions( GenericType *gen );
+ void initParserFields( GenericType *gen );
void initCtxField( GenericType *gen );
void addStdin();
@@ -880,14 +880,14 @@ struct ParseData
LangEl *intLangEl;
LangEl *strLangEl;
LangEl *streamLangEl;
- LangEl *accumStreamLangEl;
+ LangEl *inputLangEl;
LangEl *anyLangEl;
LangEl *rootLangEl;
LangEl *noTokenLangEl;
LangEl *eofLangEl;
LangEl *errorLangEl;
LangEl *defaultCharLangEl;
- LangEl *ignoreListLangEl;
+ LangEl *ignoreLangEl;
TokenRegion *rootRegion;
TokenRegion *defaultRegion;
@@ -908,7 +908,7 @@ struct ParseData
PatternList patternList;
ReplList replList;
- AccumTextList accumTextList;
+ ParserTextList parserTextList;
ObjectDef *globalObjectDef;
@@ -925,8 +925,8 @@ struct ParseData
UniqueType *uniqueTypeInt;
UniqueType *uniqueTypeStr;
UniqueType *uniqueTypeStream;
- UniqueType *uniqueTypeAccumStream;
- UniqueType *uniqueTypeIgnoreList;
+ UniqueType *uniqueTypeInput;
+ UniqueType *uniqueTypeIgnore;
UniqueType *uniqueTypeAny;
UniqueTypeMap uniqeTypeMap;
@@ -934,18 +934,18 @@ struct ParseData
UniqueMapMap uniqueMapMap;
UniqueListMap uniqueListMap;
UniqueVectorMap uniqueVectorMap;
- UniqueAccumMap uniqueAccumMap;
+ UniqueParserMap uniqueParserMap;
void initStrObject();
void initStreamObject();
- void initAccumStreamObject();
+ void initInputObject();
void initIntObject();
void initTokenObjects();
ObjectDef *intObj;
ObjectDef *strObj;
ObjectDef *streamObj;
- ObjectDef *accumStreamObj;
+ ObjectDef *inputObj;
ObjectDef *tokenObj;
FsmTables *fsmTables;
@@ -1026,10 +1026,10 @@ FsmGraph *dotStarFsm( ParseData *pd );
void errorStateLabels( const NameSet &locations );
-struct Parser;
+struct ColmParser;
-typedef AvlMap<String, Parser *, CmpStr> ParserDict;
-typedef AvlMapEl<String, Parser *> ParserDictEl;
+typedef AvlMap<String, ColmParser *, CmpStr> ParserDict;
+typedef AvlMapEl<String, ColmParser *> ParserDictEl;
LangEl *declareLangEl( ParseData *pd, Namespace *nspace, const String &data, LangEl::Type type );
LangEl *addLangEl( ParseData *pd, Namespace *nspace, const String &data, LangEl::Type type );
diff --git a/colm/parsetree.cc b/colm/parsetree.cc
index 9b06142e..1d2a6ce9 100644
--- a/colm/parsetree.cc
+++ b/colm/parsetree.cc
@@ -170,7 +170,7 @@ int CmpUniqueVector::compare( const UniqueVector &ut1, const UniqueVector &ut2 )
return 0;
}
-int CmpUniqueAccum::compare( const UniqueAccum &ut1, const UniqueAccum &ut2 )
+int CmpUniqueParser::compare( const UniqueParser &ut1, const UniqueParser &ut2 )
{
if ( ut1.parseType < ut2.parseType )
return -1;
diff --git a/colm/parsetree.h b/colm/parsetree.h
index 1794cc4a..99a78926 100644
--- a/colm/parsetree.h
+++ b/colm/parsetree.h
@@ -1236,9 +1236,9 @@ struct Replacement
typedef DList<Replacement> ReplList;
-struct AccumText
+struct ParserText
{
- AccumText( const InputLoc &loc, Namespace *nspace,
+ ParserText( const InputLoc &loc, Namespace *nspace,
TokenRegion *region, ReplItemList *list ) :
loc(loc), nspace(nspace), region(region), list(list),
langEl(0), pdaRun(0), nextBindId(1), parse(true) {}
@@ -1252,10 +1252,10 @@ struct AccumText
long nextBindId;
bool parse;
- AccumText *prev, *next;
+ ParserText *prev, *next;
};
-typedef DList<AccumText> AccumTextList;
+typedef DList<ParserText> ParserTextList;
struct Function;
@@ -1468,25 +1468,25 @@ struct CmpUniqueVector
typedef AvlBasic< UniqueVector, CmpUniqueVector > UniqueVectorMap;
/*
- * Unique Accum Types
+ * Unique Parser Types
*/
-struct UniqueAccum
- : public AvlTreeEl<UniqueAccum>
+struct UniqueParser
+ : public AvlTreeEl<UniqueParser>
{
- UniqueAccum( UniqueType *parseType ) :
+ UniqueParser( UniqueType *parseType ) :
parseType(parseType), generic(0) {}
UniqueType *parseType;
GenericType *generic;
};
-struct CmpUniqueAccum
+struct CmpUniqueParser
{
- static int compare( const UniqueAccum &ut1, const UniqueAccum &ut2 );
+ static int compare( const UniqueParser &ut1, const UniqueParser &ut2 );
};
-typedef AvlBasic< UniqueAccum, CmpUniqueAccum > UniqueAccumMap;
+typedef AvlBasic< UniqueParser, CmpUniqueParser > UniqueParserMap;
/*
*
@@ -1508,7 +1508,7 @@ struct TypeRef
Map,
List,
Vector,
- Accum,
+ Parser,
Ref,
Ptr,
};
@@ -1565,7 +1565,7 @@ struct TypeRef
UniqueType *lookupTypeMap( ParseData *pd );
UniqueType *lookupTypeList( ParseData *pd );
UniqueType *lookupTypeVector( ParseData *pd );
- UniqueType *lookupTypeAccum( ParseData *pd );
+ UniqueType *lookupTypeParser( ParseData *pd );
UniqueType *lookupType( ParseData *pd );
UniqueType *lookupTypePtr( ParseData *pd );
UniqueType *lookupTypeRef( ParseData *pd );
@@ -2040,7 +2040,7 @@ struct LangStmt
YieldType,
ForIterType,
BreakType,
- AccumType
+ ParserType
};
LangStmt( const InputLoc &loc, Type type, FieldInitVect *fieldInitVect ) :
@@ -2078,8 +2078,8 @@ struct LangStmt
type(type), varRef(varRef), expr(0), replacement(replacement),
exprPtrVect(0), next(0) {}
- LangStmt( Type type, LangVarRef *varRef, AccumText *accumText ) :
- type(type), varRef(varRef), expr(0), accumText(accumText),
+ LangStmt( Type type, LangVarRef *varRef, ParserText *parserText ) :
+ type(type), varRef(varRef), expr(0), parserText(parserText),
exprPtrVect(0), next(0) {}
/* ForIterType */
@@ -2092,9 +2092,9 @@ struct LangStmt
type(type), next(0) {}
void resolve( ParseData *pd ) const;
- void resolveAccumItems( ParseData *pd ) const;
+ void resolveParserItems( ParseData *pd ) const;
- void evaluateAccumItems( ParseData *pd, CodeVect &code ) const;
+ void evaluateParserItems( ParseData *pd, CodeVect &code ) const;
LangTerm *chooseDefaultIter( ParseData *pd, LangTerm *fromVarRef ) const;
void compileWhile( ParseData *pd, CodeVect &code ) const;
void compileForIterBody( ParseData *pd, CodeVect &code, UniqueType *iterUT ) const;
@@ -2109,7 +2109,7 @@ struct LangStmt
TypeRef *typeRef;
LangExpr *expr;
Replacement *replacement;
- AccumText *accumText;
+ ParserText *parserText;
ExprVect *exprPtrVect;
FieldInitVect *fieldInitVect;
StmtList *stmtList;
diff --git a/colm/pdabuild.cc b/colm/pdabuild.cc
index 98eff77e..aaf280e9 100644
--- a/colm/pdabuild.cc
+++ b/colm/pdabuild.cc
@@ -213,8 +213,8 @@ void ParseData::makeLangElIds()
assert( intLangEl->id == LEL_ID_INT );
assert( strLangEl->id == LEL_ID_STR );
assert( streamLangEl->id == LEL_ID_STREAM );
- assert( accumStreamLangEl->id == LEL_ID_ACCUM_STREAM );
- assert( ignoreListLangEl->id == LEL_ID_IGNORE_LIST );
+ assert( inputLangEl->id == LEL_ID_INPUT );
+ assert( ignoreLangEl->id == LEL_ID_IGNORE );
}
void ParseData::makeLangElNames()
diff --git a/colm/pdarun.c b/colm/pdarun.c
index 7b05e075..f2e6317a 100644
--- a/colm/pdarun.c
+++ b/colm/pdarun.c
@@ -679,14 +679,14 @@ void attachIgnore( Program *prg, Tree **sp, PdaRun *pdaRun, Kid *input )
IgnoreList *rightIgnore = 0;
if ( pdaRun->tokenList != 0 ) {
rightIgnore = ilAllocate( prg );
- rightIgnore->id = LEL_ID_IGNORE_LIST;
+ rightIgnore->id = LEL_ID_IGNORE;
rightIgnore->child = copyKidList( prg, ignoreKid );
rightIgnore->generation = prg->nextIlGen++;
}
/* Make the ignore list for the left-ignore. */
IgnoreList *leftIgnore = ilAllocate( prg );
- leftIgnore->id = LEL_ID_IGNORE_LIST;
+ leftIgnore->id = LEL_ID_IGNORE;
leftIgnore->child = ignoreKid;
leftIgnore->generation = prg->nextIlGen++;
@@ -1653,7 +1653,7 @@ again:
pdaRun->input1 = pdaRun->input1->next;
Tree *stTree = pdaRun->stackTop->tree;
- if ( stTree->id == LEL_ID_IGNORE_LIST ) {
+ if ( stTree->id == LEL_ID_IGNORE ) {
pdaRun->lel->next = stTree->child;
stTree->child = pdaRun->lel;
}
@@ -1663,7 +1663,7 @@ again:
ignoreList->generation = prg->nextIlGen++;
kid->tree = (Tree*)ignoreList;
- kid->tree->id = LEL_ID_IGNORE_LIST;
+ kid->tree->id = LEL_ID_IGNORE;
kid->tree->refs = 1;
kid->tree->child = pdaRun->lel;
pdaRun->lel->next = 0;
@@ -1801,7 +1801,7 @@ again:
rhsLen = prg->rtd->prodInfo[pdaRun->reduction].length;
child = last = 0;
for ( r = 0;; ) {
- if ( r == rhsLen && pdaRun->stackTop->tree->id != LEL_ID_IGNORE_LIST )
+ if ( r == rhsLen && pdaRun->stackTop->tree->id != LEL_ID_IGNORE )
break;
child = pdaRun->stackTop;
@@ -1809,12 +1809,12 @@ again:
child->next = last;
last = child;
- if ( child->tree->id != LEL_ID_IGNORE_LIST ) {
+ if ( child->tree->id != LEL_ID_IGNORE ) {
/* Count it only if it is not an ignore token. */
r++;
}
- if ( child->tree->id != LEL_ID_IGNORE_LIST )
+ if ( child->tree->id != LEL_ID_IGNORE )
realChild = child;
}
diff --git a/colm/pool.c b/colm/pool.c
index bb14d0be..3933f84e 100644
--- a/colm/pool.c
+++ b/colm/pool.c
@@ -340,15 +340,15 @@ void streamFree( Program *prg, Stream *stream )
/*
- * AccumStream
+ * Input
*/
-AccumStream *accumStreamAllocate( Program *prg )
+Input *accumStreamAllocate( Program *prg )
{
- return (AccumStream*)mapElAllocate( prg );
+ return (Input*)mapElAllocate( prg );
}
-void accumStreamFree( Program *prg, AccumStream *accumStream )
+void accumStreamFree( Program *prg, Input *accumStream )
{
mapElFree( prg, (MapEl*)accumStream );
}
diff --git a/colm/pool.h b/colm/pool.h
index 67a7f88f..b4c47247 100644
--- a/colm/pool.h
+++ b/colm/pool.h
@@ -78,8 +78,8 @@ long ilNumLost( Program *prg );
Stream *streamAllocate( Program *prg );
void streamFree( Program *prg, Stream *stream );
-AccumStream *accumStreamAllocate( Program *prg );
-void accumStreamFree( Program *prg, AccumStream *stream );
+Input *accumStreamAllocate( Program *prg );
+void accumStreamFree( Program *prg, Input *stream );
/* Wrong place. */
TreePair mapRemove( Program *prg, Map *map, Tree *key );
diff --git a/colm/program.c b/colm/program.c
index ab04bda6..ecca2e6a 100644
--- a/colm/program.c
+++ b/colm/program.c
@@ -54,7 +54,7 @@ void colmRunProgram( Program *prg )
assert( sizeof(Map) <= sizeof(MapEl) );
assert( sizeof(List) <= sizeof(MapEl) );
assert( sizeof(Stream) <= sizeof(MapEl) );
- assert( sizeof(Accum) <= sizeof(MapEl) );
+ assert( sizeof(Parser) <= sizeof(MapEl) );
/* Allocate the global variable. */
allocGlobal( prg );
diff --git a/colm/resolve.cc b/colm/resolve.cc
index 580cbec2..e0c837df 100644
--- a/colm/resolve.cc
+++ b/colm/resolve.cc
@@ -181,18 +181,18 @@ UniqueType *TypeRef::lookupTypeVector( ParseData *pd )
return pd->findUniqueType( TYPE_TREE, inMap->generic->langEl );
}
-UniqueType *TypeRef::lookupTypeAccum( ParseData *pd )
+UniqueType *TypeRef::lookupTypeParser( ParseData *pd )
{
/* Lookup up the qualifiction and then the name. */
nspace = nspaceQual->getQual( pd );
UniqueType *utParse = typeRef1->lookupType( pd );
- UniqueAccum searchKey( utParse );
- UniqueAccum *inMap = pd->uniqueAccumMap.find( &searchKey );
+ UniqueParser searchKey( utParse );
+ UniqueParser *inMap = pd->uniqueParserMap.find( &searchKey );
if ( inMap == 0 ) {
- inMap = new UniqueAccum( utParse );
- pd->uniqueAccumMap.insert( inMap );
+ inMap = new UniqueParser( utParse );
+ pd->uniqueParserMap.insert( inMap );
/* FIXME: Need uniqe name allocator for types. */
static int accumId = 0;
@@ -294,8 +294,8 @@ UniqueType *TypeRef::lookupType( ParseData *pd )
case Vector:
uniqueType = lookupTypeVector( pd );
break;
- case Accum:
- uniqueType = lookupTypeAccum( pd );
+ case Parser:
+ uniqueType = lookupTypeParser( pd );
break;
case Ptr:
uniqueType = lookupTypePtr( pd );
@@ -399,10 +399,10 @@ void LangExpr::resolve( ParseData *pd ) const
}
}
-void LangStmt::resolveAccumItems( ParseData *pd ) const
+void LangStmt::resolveParserItems( ParseData *pd ) const
{
/* Assign bind ids to the variables in the replacement. */
- for ( ReplItemList::Iter item = *accumText->list; item.lte(); item++ ) {
+ for ( ReplItemList::Iter item = *parserText->list; item.lte(); item++ ) {
varRef->resolve( pd );
switch ( item->type ) {
@@ -492,7 +492,7 @@ void LangStmt::resolve( ParseData *pd ) const
varRef->resolve( pd );
break;
}
- case AccumType: {
+ case ParserType: {
//for ( )
break;
}
@@ -664,9 +664,9 @@ void ParseData::resolveReplacementEls()
}
}
-void ParseData::resolveAccumEls()
+void ParseData::resolveParserEls()
{
- for ( AccumTextList::Iter accum = accumTextList; accum.lte(); accum++ ) {
+ for ( ParserTextList::Iter accum = parserTextList; accum.lte(); accum++ ) {
for ( ReplItemList::Iter item = *accum->list; item.lte(); item++ ) {
switch ( item->type ) {
case ReplItem::FactorType:
@@ -773,7 +773,7 @@ void ParseData::typeResolve()
/* Resolve pattern and replacement elements. */
resolvePatternEls();
resolveReplacementEls();
- resolveAccumEls();
+ resolveParserEls();
resolveParseTree();
diff --git a/colm/tree.c b/colm/tree.c
index 22aeea12..c8eb81dc 100644
--- a/colm/tree.c
+++ b/colm/tree.c
@@ -368,7 +368,7 @@ Tree *constructReplacementTree( Kid *kid, Tree **bindings, Program *prg, long pa
tree = splitTree( prg, tree );
leftIgnore = ilAllocate( prg );
- leftIgnore->id = LEL_ID_IGNORE_LIST;
+ leftIgnore->id = LEL_ID_IGNORE;
leftIgnore->child = ignore;
leftIgnore->generation = prg->nextIlGen++;
@@ -414,7 +414,7 @@ Tree *constructReplacementTree( Kid *kid, Tree **bindings, Program *prg, long pa
tree->child = kidListConcat( attrs, child );
if ( ignore != 0 ) {
IgnoreList *ignoreList = ilAllocate( prg );
- ignoreList->id = LEL_ID_IGNORE_LIST;
+ ignoreList->id = LEL_ID_IGNORE;
ignoreList->refs = 1;
ignoreList->child = ignore;
ignoreList->generation = prg->nextIlGen++;
@@ -804,19 +804,19 @@ Tree *createGeneric( Program *prg, long genericId )
break;
}
case GEN_PARSER: {
- Accum *accum = (Accum*)mapElAllocate( prg );
- accum->id = genericInfo->langElId;
- accum->genericInfo = genericInfo;
- accum->fsmRun = malloc( sizeof(FsmRun) );
- accum->pdaRun = malloc( sizeof(PdaRun) );
+ Parser *parser = (Parser*)mapElAllocate( prg );
+ parser->id = genericInfo->langElId;
+ parser->genericInfo = genericInfo;
+ parser->fsmRun = malloc( sizeof(FsmRun) );
+ parser->pdaRun = malloc( sizeof(PdaRun) );
/* Start off the parsing process. */
- initPdaRun( accum->pdaRun, prg, prg->rtd->pdaTables,
- accum->fsmRun, genericInfo->parserId, false, false, 0 );
- initFsmRun( accum->fsmRun, prg );
- newToken( prg, accum->pdaRun, accum->fsmRun );
+ initPdaRun( parser->pdaRun, prg, prg->rtd->pdaTables,
+ parser->fsmRun, genericInfo->parserId, false, false, 0 );
+ initFsmRun( parser->fsmRun, prg );
+ newToken( prg, parser->pdaRun, parser->fsmRun );
- newGeneric = (Tree*) accum;
+ newGeneric = (Tree*) parser;
break;
}
default:
@@ -865,13 +865,13 @@ free_tree:
mapElFree( prg, (MapEl*)map );
}
else if ( generic->type == GEN_PARSER ) {
- Accum *accum = (Accum*)tree;
- clearFsmRun( prg, accum->fsmRun );
- clearPdaRun( prg, sp, accum->pdaRun );
- free( accum->pdaRun );
- free( accum->fsmRun );
- treeDownref( prg, sp, (Tree*)accum->accumStream );
- mapElFree( prg, (MapEl*)accum );
+ Parser *parser = (Parser*)tree;
+ clearFsmRun( prg, parser->fsmRun );
+ clearPdaRun( prg, sp, parser->pdaRun );
+ free( parser->pdaRun );
+ free( parser->fsmRun );
+ treeDownref( prg, sp, (Tree*)parser->input );
+ mapElFree( prg, (MapEl*)parser );
}
else {
assert(false);
@@ -894,13 +894,13 @@ free_tree:
fclose( s->file );
streamFree( prg, s );
}
- else if ( tree->id == LEL_ID_ACCUM_STREAM ) {
- AccumStream *s = (AccumStream*)tree;
+ else if ( tree->id == LEL_ID_INPUT ) {
+ Input *s = (Input*)tree;
free( s->in );
accumStreamFree( prg, s );
}
else {
- if ( tree->id != LEL_ID_IGNORE_LIST )
+ if ( tree->id != LEL_ID_IGNORE )
stringFree( prg, tree->tokdata );
/* Attributes and grammar-based children. */
@@ -912,7 +912,7 @@ free_tree:
child = next;
}
- if ( tree->id == LEL_ID_IGNORE_LIST )
+ if ( tree->id == LEL_ID_IGNORE )
ilFree( prg, (IgnoreList*) tree );
else if ( tree->flags & AF_PARSE_TREE )
parseTreeFree( prg, (ParseTree*)tree );
@@ -2019,7 +2019,7 @@ rec_call:
}
/* If it is an ignore list, queue it and skip past the content. */
- if ( kid->tree->id == LEL_ID_IGNORE_LIST ) {
+ if ( kid->tree->id == LEL_ID_IGNORE ) {
/* Ignore suppression can be triggered by a suppress right or suppress
* outside left for example. */
if ( ! (printFlags & IPF_SUPPRESS ) ) {
@@ -2304,7 +2304,7 @@ void printTermXml( Program *prg, Tree **sp, struct ColmPrintArgs *printArgs, Kid
xmlEscapeData( printArgs, (char*)(head->data), head->length );
}
else if ( 0 < kid->tree->id && kid->tree->id < prg->rtd->firstNonTermId &&
- kid->tree->id != LEL_ID_IGNORE_LIST &&
+ kid->tree->id != LEL_ID_IGNORE &&
kid->tree->tokdata != 0 &&
stringLength( kid->tree->tokdata ) > 0 )
{
diff --git a/colm/tree.h b/colm/tree.h
index 63da66aa..fbec2ec2 100644
--- a/colm/tree.h
+++ b/colm/tree.h
@@ -205,7 +205,7 @@ typedef struct _Stream
SourceStream *in;
} Stream;
-typedef struct _AccumStream
+typedef struct _Input
{
/* Must overlay Tree. */
short id;
@@ -214,9 +214,9 @@ typedef struct _AccumStream
Kid *child;
InputStream *in;
-} AccumStream;
+} Input;
-typedef struct AccumStruct
+typedef struct _Parser
{
/* Must overlay Tree. */
short id;
@@ -228,9 +228,9 @@ typedef struct AccumStruct
struct _PdaRun *pdaRun;
struct _FsmRun *fsmRun;
- struct _AccumStream *accumStream;
+ struct _Input *input;
Tree *result;
-} Accum;
+} Parser;
typedef struct _TreeIter
{