summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2018-05-15 17:58:55 -0400
committerAdrian Thurston <thurston@colm.net>2018-05-15 17:58:55 -0400
commite9e58383d07766cc9721b6a1efd1b46facf0fffa (patch)
treec30429c2bfacc6c5c484105c2dcb2ded92327fd7
parent44f8ba6d73a3de862d05c5606fda32a3141018aa (diff)
downloadcolm-e9e58383d07766cc9721b6a1efd1b46facf0fffa.tar.gz
merged the PARSE_LOAD instruction into SEND
-rw-r--r--src/bytecode.c49
-rw-r--r--src/bytecode.h4
-rw-r--r--src/synthesis.cc1
3 files changed, 30 insertions, 24 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index ae57763a..967181a3 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -2346,11 +2346,14 @@ again:
vm_push_stream( stream );
- instr += SIZEOF_CODE + SIZEOF_CODE;
+ instr += SIZEOF_CODE;
}
else {
stream_append_text( prg, sp, stream, input );
vm_push_stream( stream );
+
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
}
colm_tree_downref( prg, sp, input );
@@ -2373,7 +2376,7 @@ again:
vm_push_stream( stream );
- instr += SIZEOF_CODE + SIZEOF_CODE;
+ instr += SIZEOF_CODE;
}
else {
parser_t *parser = stream->parser;
@@ -2388,6 +2391,9 @@ again:
rcode_word( exec, (word_t) input );
rcode_word( exec, (word_t) len );
rcode_unit_term( exec );
+
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
}
break;
}
@@ -2425,13 +2431,16 @@ again:
vm_push_stream( stream );
- instr += SIZEOF_CODE + SIZEOF_CODE;
+ instr += SIZEOF_CODE;
}
else {
parser_t *parser = stream->parser;
stream_append_tree( prg, sp, parser->input, input );
vm_push_stream( stream );
+
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
}
colm_tree_downref( prg, sp, input );
@@ -2454,7 +2463,7 @@ again:
vm_push_stream( stream );
- instr += SIZEOF_CODE + SIZEOF_CODE;
+ instr += SIZEOF_CODE;
}
else {
parser_t *parser = stream->parser;
@@ -2469,6 +2478,9 @@ again:
rcode_word( exec, (word_t) input );
rcode_word( exec, (word_t) len );
rcode_unit_term( exec );
+
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
}
break;
}
@@ -2499,6 +2511,10 @@ again:
vm_push_stream( stream );
stream_append_stream( prg, sp, stream->parser->input, input );
+
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
+
break;
}
case IN_SEND_STREAM_WV: {
@@ -2517,6 +2533,10 @@ again:
rcode_word( exec, (word_t) input );
rcode_word( exec, (word_t) len );
rcode_unit_term( exec );
+
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
+
break;
}
@@ -2554,7 +2574,11 @@ again:
}
if ( stream->parser == 0 )
- instr += SIZEOF_CODE + SIZEOF_CODE;
+ instr += SIZEOF_CODE;
+ else {
+ exec->steps = stream->parser->pda_run->steps;
+ exec->pcr = PCR_START;
+ }
break;
}
@@ -2618,17 +2642,6 @@ again:
* write the backtrack instruction. Start fresh with a private value
* on a PCR_CALL by pushing and initializing. */
- case IN_PARSE_LOAD: {
- debug( prg, REALM_BYTECODE, "IN_PARSE_LOAD\n" );
-
- stream_t *stream = vm_pop_stream();
- vm_push_stream( stream );
-
- exec->steps = stream->parser->pda_run->steps;
- exec->pcr = PCR_START;
- break;
- }
-
case IN_PARSE_INIT_BKT: {
debug( prg, REALM_BYTECODE, "IN_PARSE_INIT_BKT\n" );
@@ -4661,10 +4674,6 @@ static void rcode_downref( program_t *prg, tree_t **sp, code_t *instr )
{
again:
switch ( *instr++ ) {
- case IN_PARSE_LOAD: {
- debug( prg, REALM_BYTECODE, "IN_PARSE_LOAD\n" );
- break;
- }
case IN_PARSE_INIT_BKT: {
debug( prg, REALM_BYTECODE, "IN_PARSE_INIT_BKT\n" );
diff --git a/src/bytecode.h b/src/bytecode.h
index 114bafc5..0ebbdd29 100644
--- a/src/bytecode.h
+++ b/src/bytecode.h
@@ -257,10 +257,8 @@ typedef unsigned char uchar;
#define IN_INPUT_CLOSE_WC 0xef
-#define IN_PARSE_LOAD 0xa0
-#define IN_PARSE_INIT_BKT 0xa1
-
#define IN_PARSE_FRAG_W 0xa2
+#define IN_PARSE_INIT_BKT 0xa1
#define IN_PARSE_FRAG_BKT 0xa6
#define IN_SEND_TREE_WC 0xa8
diff --git a/src/synthesis.cc b/src/synthesis.cc
index f2526d49..08f120dc 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -1420,7 +1420,6 @@ UniqueType *LangTerm::evaluateConstruct( Compiler *pd, CodeVect &code ) const
void LangTerm::parseFrag( Compiler *pd, CodeVect &code, int stopId )
{
- code.append( IN_PARSE_LOAD );
code.append( IN_PARSE_FRAG_W );
}