summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2011-12-31 07:57:04 +0000
committerAdrian Thurston <thurston@complang.org>2011-12-31 07:57:04 +0000
commit127782c33740f49cac09317d1136dcc77a02d97c (patch)
treeb973fcf324ad0706b91003b6f744a0004df077bf
parentea4ea1c760e895596cc0cb9d220beee3f0a24596 (diff)
downloadcolm-127782c33740f49cac09317d1136dcc77a02d97c.tar.gz
Minor tweaking to the buffer clearing. Need to work out exactly when to do
this. refs #341.
-rw-r--r--colm/pdarun.c13
-rwxr-xr-xtest/runtests.mk6
2 files changed, 10 insertions, 9 deletions
diff --git a/colm/pdarun.c b/colm/pdarun.c
index b901570d..b6958896 100644
--- a/colm/pdarun.c
+++ b/colm/pdarun.c
@@ -250,10 +250,7 @@ static void sendBackText( FsmRun *fsmRun, InputStream *inputStream, const char *
/* 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;
- else
- fsmRun->pe = fsmRun->p;
+ clearBuffered( fsmRun );
/* slide data back. */
// fsmRun->p = fsmRun->pe = fsmRun->runBuf->data;
@@ -393,10 +390,13 @@ 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 )
+ if ( fsmRun->tokstart != 0 ) {
fsmRun->p = fsmRun->pe = fsmRun->tokstart;
- else
+ fsmRun->tokstart = 0;
+ }
+ else {
fsmRun->pe = fsmRun->p;
+ }
}
/* Stops on:
@@ -1219,7 +1219,6 @@ case PcrGeneration:
pdaRun->input1 = sendToken( prg, sp, inputStream, fsmRun, pdaRun, pdaRun->tokenId );
}
-
long pcr = parseToken( prg, sp, pdaRun, fsmRun, inputStream, PcrStart );
while ( pcr != PcrDone ) {
diff --git a/test/runtests.mk b/test/runtests.mk
index ba5cee07..3212ea57 100755
--- a/test/runtests.mk
+++ b/test/runtests.mk
@@ -68,7 +68,8 @@ TESTS = \
div.lm \
scope1.lm \
export1.lm \
- lhs1.lm
+ lhs1.lm \
+ binary1.lm
DIFFS = \
ambig1.diff \
@@ -136,7 +137,8 @@ DIFFS = \
div.diff \
scope1.diff \
export1.diff \
- lhs1.diff
+ lhs1.diff \
+ binary1.diff
all: runtests.mk $(DIFFS) $(SUBDIRS)