summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bytecode.c10
-rw-r--r--src/bytecode.h1
-rw-r--r--src/synthesis.cc7
3 files changed, 16 insertions, 2 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 41160f6b..41cd1445 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -2385,6 +2385,16 @@ again:
break;
}
+ case IN_SEND_EOF: {
+ debug( prg, REALM_BYTECODE, "IN_SEND_EOF\n" );
+ stream_t *stream = vm_pop_stream();
+ vm_push_stream( stream );
+
+ if ( stream->parser == 0 )
+ instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_HALF + SIZEOF_CODE + SIZEOF_CODE;
+ break;
+ }
+
case IN_INPUT_CLOSE_WC: {
debug( prg, REALM_BYTECODE, "IN_INPUT_CLOSE_WC\n" );
diff --git a/src/bytecode.h b/src/bytecode.h
index 722ec8bd..99e627e9 100644
--- a/src/bytecode.h
+++ b/src/bytecode.h
@@ -272,6 +272,7 @@ typedef unsigned char uchar;
#define IN_SEND_TREE_WC 0xa8
#define IN_SEND_TREE_WV 0xa9
#define IN_SEND_TREE_BKT 0xaa
+#define IN_SEND_EOF 0x87
#define IN_SEND_STREAM_WC 0x96
#define IN_SEND_STREAM_WV 0x90
diff --git a/src/synthesis.cc b/src/synthesis.cc
index 198f0fa4..dc9289d8 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -1050,6 +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 );
LangTerm::parseFinish( pd, code, 0 );
@@ -1423,7 +1424,6 @@ UniqueType *LangTerm::evaluateConstruct( Compiler *pd, CodeVect &code ) const
void LangTerm::parseFrag( Compiler *pd, CodeVect &code, int stopId )
{
- /* Parse instruction. */
code.append( IN_PARSE_LOAD );
code.append( IN_PARSE_FRAG_W );
code.appendHalf( stopId );
@@ -1609,6 +1609,7 @@ UniqueType *LangTerm::evaluateParse( Compiler *pd, CodeVect &code,
* Finish operation
*/
+ code.append( IN_SEND_EOF );
parseFinish( pd, code, stopId );
/* Pull out the error and save it off. */
@@ -1709,8 +1710,10 @@ void LangTerm::evaluateSendParser( Compiler *pd, CodeVect &code, bool strings )
parseFrag( pd, code, 0 );
}
- if ( eof )
+ if ( eof ) {
+ code.append( IN_SEND_EOF );
parseFinish( pd, code, 0 );
+ }
}
UniqueType *LangTerm::evaluateSend( Compiler *pd, CodeVect &code ) const