diff options
-rw-r--r-- | colm/bytecode.c | 2 | ||||
-rw-r--r-- | colm/input.c | 23 | ||||
-rw-r--r-- | colm/pdarun.c | 2 | ||||
-rw-r--r-- | colm/synthesis.cc | 26 |
4 files changed, 16 insertions, 37 deletions
diff --git a/colm/bytecode.c b/colm/bytecode.c index cb8001ab..9c019d2e 100644 --- a/colm/bytecode.c +++ b/colm/bytecode.c @@ -173,7 +173,7 @@ Word streamAppend( Program *prg, Tree **sp, Tree *input, StreamImpl *is ) length = collect.length; strCollectDestroy( &collect ); } - else if ( input->id == LEL_ID_STREAM ) { + else if ( input->id == LEL_ID_STREAM || input->id == LEL_ID_INPUT ) { treeUpref( input ); is->funcs->appendStream( is, input ); } diff --git a/colm/input.c b/colm/input.c index 64871979..2d60cee8 100644 --- a/colm/input.c +++ b/colm/input.c @@ -674,16 +674,23 @@ void _prependData( StreamImpl *is, const char *data, long length ) if ( is->attached != 0 ) detachStream( is->attached, is ); - /* Create a new buffer for the data. This is the easy implementation. - * Something better is needed here. It puts a max on the amount of - * data that can be pushed back to the inputStream. */ - assert( length < FSM_BUFSIZE ); + if ( isSourceStream( is ) && ((Stream*)is->queue->tree)->in->funcs == &streamFuncs ) { + Stream *stream = (Stream*)is->queue->tree; - RunBuf *newBuf = newRunBuf(); - newBuf->length = length; - memcpy( newBuf->data, data, length ); + _prependData( stream->in, data, length ); + } + else { + /* Create a new buffer for the data. This is the easy implementation. + * Something better is needed here. It puts a max on the amount of + * data that can be pushed back to the inputStream. */ + assert( length < FSM_BUFSIZE ); - inputStreamPrepend( is, newBuf ); + RunBuf *newBuf = newRunBuf(); + newBuf->length = length; + memcpy( newBuf->data, data, length ); + + inputStreamPrepend( is, newBuf ); + } } int _undoPrependData( StreamImpl *is, int length ) diff --git a/colm/pdarun.c b/colm/pdarun.c index 667a0eb5..648538c3 100644 --- a/colm/pdarun.c +++ b/colm/pdarun.c @@ -277,8 +277,6 @@ void detachSource( FsmRun *fsmRun, StreamImpl *is ) void clearBuffered( FsmRun *fsmRun ) { - /* If there is data in the current buffer then send the whole send back - * should be in this buffer. */ if ( fsmRun->tokstart != 0 ) { fsmRun->p = fsmRun->pe = fsmRun->tokstart; fsmRun->tokstart = 0; diff --git a/colm/synthesis.cc b/colm/synthesis.cc index 13d54dc6..f01a4f41 100644 --- a/colm/synthesis.cc +++ b/colm/synthesis.cc @@ -1419,32 +1419,6 @@ UniqueType *LangTerm::evaluateParse( Compiler *pd, CodeVect &code, bool stop, bo /*****************************/ - if ( parserText->list->length() == 1 && - parserText->list->head->type == ConsItem::ExprType ) - { - /* Only one argument and it is an expression type. Evaluate it (but - * ignore the code) to determine if it is an input type. */ - CodeVect unused; - UniqueType *ut = parserText->list->head->expr->evaluate( pd, unused ); - - if ( ut == pd->uniqueTypeInput ) { - /* Only one argument and it is an input object. Set the input into - * the parser and parse using it. */ - code.append( IN_DUP_TOP ); - - parserText->list->head->expr->evaluate( pd, code ); - - code.append( IN_TOP_SWAP ); - code.append( IN_SET_INPUT ); - - code.append( IN_DUP_TOP ); - - parseFrag( pd, code, stopId ); - - goto finish; - } - } - code.append( IN_DUP_TOP ); code.append( IN_CONSTRUCT_INPUT ); code.append( IN_TOP_SWAP ); |