summaryrefslogtreecommitdiff
path: root/colm/ctinput.cpp
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2009-04-07 02:10:57 +0000
committerAdrian Thurston <thurston@complang.org>2009-04-07 02:10:57 +0000
commitbe7e16e574e18ba267f1d1c60efe27271b01efb6 (patch)
treeea99f8bf859a831ed0157bc32cb0ad7c7a827209 /colm/ctinput.cpp
parent08336de7c4bd1f347ea816919adab77cc8c83fe8 (diff)
downloadcolm-be7e16e574e18ba267f1d1c60efe27271b01efb6.tar.gz
Eliminated sendBackText from Input. This was used only for Repl and Pattern
input structures and was necessary because of named langEls. Now a named langEl causes a new runBuf so we no longer need to send back parts of runBufs just before a named langEl is sent back. The fact that we create a new runBuf means some extra cost, but this is only for compile-time activities and is justified compared to the added complexity of an inconsistent interface.
Diffstat (limited to 'colm/ctinput.cpp')
-rw-r--r--colm/ctinput.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/colm/ctinput.cpp b/colm/ctinput.cpp
index ebb9ba2d..4c7de97b 100644
--- a/colm/ctinput.cpp
+++ b/colm/ctinput.cpp
@@ -22,6 +22,7 @@
#include "parsedata.h"
#include "parsetree.h"
#include "input.h"
+#include "fsmrun.h"
/*
* Pattern
@@ -108,8 +109,11 @@ void InputStreamPattern::backup()
patItem = patItem->prev;
}
-void InputStreamPattern::pushBackData( char *data, long length )
+void InputStreamPattern::pushBackBuf( RunBuf *runBuf )
{
+ char *data = runBuf->buf + runBuf->offset;
+ long length = runBuf->length;
+
if ( length == 0 )
return;
@@ -126,11 +130,6 @@ void InputStreamPattern::pushBackData( char *data, long length )
assert( memcmp( &patItem->data[offset], data, length ) == 0 );
}
-void InputStreamPattern::pushBackBuf( RunBuf *runBuf )
-{
- assert( false );
-}
-
void InputStreamPattern::pushBackNamed()
{
backup();
@@ -237,10 +236,13 @@ void InputStreamRepl::backup()
replItem = replItem->prev;
}
-void InputStreamRepl::pushBackData( char *data, long length )
+void InputStreamRepl::pushBackBuf( RunBuf *runBuf )
{
+ char *data = runBuf->buf + runBuf->offset;
+ long length = runBuf->length;
+
if ( colm_log_parse ) {
- cerr << "pushBackData: ";
+ cerr << "push back data: ";
cerr.write( data, length );
cerr << endl;
}
@@ -261,11 +263,6 @@ void InputStreamRepl::pushBackData( char *data, long length )
assert( memcmp( &replItem->data[offset], data, length ) == 0 );
}
-void InputStreamRepl::pushBackBuf( RunBuf *runBuf )
-{
- assert( false );
-}
-
void InputStreamRepl::pushBackNamed()
{
backup();