summaryrefslogtreecommitdiff
path: root/FlexLexer.h
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1995-03-05 16:50:49 +0000
committerVern Paxson <vern@ee.lbl.gov>1995-03-05 16:50:49 +0000
commit3987e1c0f01f08560c23373d6a8c2e13dc85e68e (patch)
tree3a5bf1cac68ce660312e5c0d0f190049b5c0279c /FlexLexer.h
parent6dca1ef5c955e3c8abb3e7a382dbf9e4a37bda1e (diff)
Added switch_streams
Diffstat (limited to 'FlexLexer.h')
-rw-r--r--FlexLexer.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/FlexLexer.h b/FlexLexer.h
index f430b68..8289148 100644
--- a/FlexLexer.h
+++ b/FlexLexer.h
@@ -66,6 +66,18 @@ public:
virtual int yylex() = 0;
+ // Call yylex with new input/output sources.
+ int yylex( istream* new_in = 0, ostream* new_out = 0 )
+ {
+ switch_streams( new_in, new_out );
+ return yylex();
+ }
+
+ // Switch to new input/output streams. A nil stream pointer
+ // indicates "keep the current one".
+ virtual void switch_streams( istream* new_in = 0,
+ ostream* new_out = 0 ) = 0;
+
protected:
char* yytext;
int yyleng;
@@ -89,6 +101,7 @@ public:
void yyrestart( istream* s );
virtual int yylex();
+ virtual void switch_streams( istream* new_in, ostream* new_out );
protected:
virtual int LexerInput( char* buf, int max_size );