diff options
-rw-r--r-- | src/bytecode.c | 40 | ||||
-rw-r--r-- | src/bytecode.h | 3 | ||||
-rw-r--r-- | src/pdarun.c | 10 | ||||
-rw-r--r-- | src/synthesis.cc | 6 |
4 files changed, 39 insertions, 20 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 72cd01fa..1c449521 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -2301,8 +2301,6 @@ again: instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_HALF + SIZEOF_CODE + SIZEOF_CODE; } else { - parser_t *parser = stream->parser; - stream_append_text( prg, sp, stream, input ); vm_push_stream( stream ); } @@ -2489,16 +2487,40 @@ again: break; } - case IN_SEND_EOF: { - debug( prg, REALM_BYTECODE, "IN_SEND_EOF\n" ); + case IN_SEND_EOF_W: { + struct stream_impl *si; + + debug( prg, REALM_BYTECODE, "IN_SEND_EOF_W\n" ); stream_t *stream = vm_pop_stream(); vm_push_stream( stream ); + si = stream_to_impl( stream ); + si->funcs->set_eof( si ); + + if ( exec->WV ) { + rcode_unit_start( exec ); + rcode_code( exec, IN_SEND_EOF_BKT ); + rcode_word( exec, (word_t) stream ); + rcode_unit_term( exec ); + } + if ( stream->parser == 0 ) instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_HALF + SIZEOF_CODE + SIZEOF_CODE; break; } + case IN_SEND_EOF_BKT: { + stream_t *stream; + read_stream( stream ); + + debug( prg, REALM_BYTECODE, "IN_SEND_EOF_BKT\n" ); + + struct stream_impl *si = stream_to_impl( stream->parser->input ); + si->funcs->unset_eof( si ); + break; + + } + case IN_INPUT_CLOSE_WC: { debug( prg, REALM_BYTECODE, "IN_INPUT_CLOSE_WC\n" ); @@ -2791,10 +2813,7 @@ again: case IN_PARSE_FINISH_EXIT_BKT: { debug( prg, REALM_BYTECODE, "IN_PARSE_FINISH_EXIT_BKT\n" ); - stream_t *stream = vm_pop_stream(); - - struct stream_impl *si = stream_to_impl( stream->parser->input ); - si->funcs->unset_eof( si ); + vm_pop_stream(); break; } @@ -4729,6 +4748,11 @@ again: break; } + case IN_SEND_EOF_BKT: { + debug( prg, REALM_BYTECODE, "IN_SEND_EOF_BKT\n" ); + consume_word(); //( parser ); + break; + } case IN_LOAD_TREE: { tree_t *w; diff --git a/src/bytecode.h b/src/bytecode.h index 18a5faad..fb866c1a 100644 --- a/src/bytecode.h +++ b/src/bytecode.h @@ -278,7 +278,8 @@ typedef unsigned char uchar; #define IN_SEND_STREAM_WV 0x90 #define IN_SEND_STREAM_BKT 0x1c -#define IN_SEND_EOF 0x87 +#define IN_SEND_EOF_W 0x87 +#define IN_SEND_EOF_BKT 0xa4 #define IN_PARSE_FINISH_W 0xab #define IN_PARSE_FINISH_EXIT_W 0xac diff --git a/src/pdarun.c b/src/pdarun.c index 2914e562..922d44d8 100644 --- a/src/pdarun.c +++ b/src/pdarun.c @@ -2241,7 +2241,8 @@ long colm_parse_frag( program_t *prg, tree_t **sp, struct pda_run *pda_run, } long colm_parse_finish( program_t *prg, tree_t **sp, - struct pda_run *pda_run, stream_t *input , int revert_on, long entry ) + struct pda_run *pda_run, stream_t *input, + int revert_on, long entry ) { struct stream_impl *si; @@ -2250,7 +2251,6 @@ long colm_parse_finish( program_t *prg, tree_t **sp, case PCR_START: si = stream_to_impl( input ); - si->funcs->set_eof( si ); if ( ! pda_run->parse_error ) { si = stream_to_impl( input ); @@ -2270,12 +2270,6 @@ long colm_parse_finish( program_t *prg, tree_t **sp, } } - /* FIXME: need something here to check that we are not stopped waiting for - * more data when we are actually expected to finish. This check doesn't - * work (at time of writing). */ - //assert( (pdaRun->stopTarget > 0 && pdaRun->stopParsing) || - // streamToImpl( input )->eofSent ); - /* Flush out anything not committed. */ if ( pda_run->reducer ) commit_reduce( prg, sp, pda_run ); diff --git a/src/synthesis.cc b/src/synthesis.cc index 96092539..7f5cbe1e 100644 --- a/src/synthesis.cc +++ b/src/synthesis.cc @@ -1050,7 +1050,7 @@ void LangVarRef::callOperation( Compiler *pd, CodeVect &code, VarRefLookup &look if ( isFinishCall( lookup ) ) { code.append( IN_GET_PARSER_STREAM ); - code.append( IN_SEND_EOF ); + code.append( IN_SEND_EOF_W ); LangTerm::parseFinish( pd, code, 0 ); @@ -1610,7 +1610,7 @@ UniqueType *LangTerm::evaluateParse( Compiler *pd, CodeVect &code, */ if ( !stop ) { - code.append( IN_SEND_EOF ); + code.append( IN_SEND_EOF_W ); parseFinish( pd, code, stopId ); } @@ -1713,7 +1713,7 @@ void LangTerm::evaluateSendParser( Compiler *pd, CodeVect &code, bool strings ) } if ( eof ) { - code.append( IN_SEND_EOF ); + code.append( IN_SEND_EOF_W ); parseFinish( pd, code, 0 ); } } |