]> granicus.if.org Git - flex/commitdiff
Added switch_streams
authorVern Paxson <vern@ee.lbl.gov>
Sun, 5 Mar 1995 16:50:49 +0000 (16:50 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Sun, 5 Mar 1995 16:50:49 +0000 (16:50 +0000)
FlexLexer.h

index f430b687428eef537d65deed97c5ff182b621bc7..8289148ac43fee8e90828d98b7d1be1f4c30a2e0 100644 (file)
@@ -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 );