summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FlexLexer.h30
-rw-r--r--examples/testxxLexer.l6
-rw-r--r--flex.skl4
3 files changed, 22 insertions, 18 deletions
diff --git a/FlexLexer.h b/FlexLexer.h
index e79e1d9..e2d764f 100644
--- a/FlexLexer.h
+++ b/FlexLexer.h
@@ -47,7 +47,11 @@
#ifndef __FLEX_LEXER_H
// Never included before - need to define base class.
#define __FLEX_LEXER_H
-#include <iostream.h>
+
+#include <iostream>
+# ifndef FLEX_STD
+# define FLEX_STD std::
+# endif
extern "C++" {
@@ -64,14 +68,14 @@ public:
virtual void
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
virtual struct yy_buffer_state*
- yy_create_buffer( istream* s, int size ) = 0;
+ yy_create_buffer( FLEX_STD istream* s, int size ) = 0;
virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
- virtual void yyrestart( istream* s ) = 0;
+ virtual void yyrestart( FLEX_STD istream* s ) = 0;
virtual int yylex() = 0;
// Call yylex with new input/output sources.
- int yylex( istream* new_in, ostream* new_out = 0 )
+ int yylex( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 )
{
switch_streams( new_in, new_out );
return yylex();
@@ -79,8 +83,8 @@ public:
// 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;
+ virtual void switch_streams( FLEX_STD istream* new_in = 0,
+ FLEX_STD ostream* new_out = 0 ) = 0;
int lineno() const { return yylineno; }
@@ -109,17 +113,17 @@ class yyFlexLexer : public FlexLexer {
public:
// arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex().
- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
+ yyFlexLexer( FLEX_STD istream* arg_yyin = 0, FLEX_STD ostream* arg_yyout = 0 );
virtual ~yyFlexLexer();
void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
- struct yy_buffer_state* yy_create_buffer( istream* s, int size );
+ struct yy_buffer_state* yy_create_buffer( FLEX_STD istream* s, int size );
void yy_delete_buffer( struct yy_buffer_state* b );
- void yyrestart( istream* s );
+ void yyrestart( FLEX_STD istream* s );
virtual int yylex();
- virtual void switch_streams( istream* new_in, ostream* new_out );
+ virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out );
protected:
virtual int LexerInput( char* buf, int max_size );
@@ -130,7 +134,7 @@ protected:
int yyinput();
void yy_load_buffer_state();
- void yy_init_buffer( struct yy_buffer_state* b, istream* s );
+ void yy_init_buffer( struct yy_buffer_state* b, FLEX_STD istream* s );
void yy_flush_buffer( struct yy_buffer_state* b );
int yy_start_stack_ptr;
@@ -145,8 +149,8 @@ protected:
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
- istream* yyin; // input source for default LexerInput
- ostream* yyout; // output sink for default LexerOutput
+ FLEX_STD istream* yyin; // input source for default LexerInput
+ FLEX_STD ostream* yyout; // output sink for default LexerOutput
struct yy_buffer_state* yy_current_buffer;
diff --git a/examples/testxxLexer.l b/examples/testxxLexer.l
index 9421541..e2aed33 100644
--- a/examples/testxxLexer.l
+++ b/examples/testxxLexer.l
@@ -39,13 +39,13 @@ number {num1}|{num2}
}
}
-{number} cout << "number " << YYText() << '\n';
+{number} FLEX_STD cout << "number " << YYText() << '\n';
\n mylineno++;
-{name} cout << "name " << YYText() << '\n';
+{name} FLEX_STD cout << "name " << YYText() << '\n';
-{string} cout << "string " << YYText() << '\n';
+{string} FLEX_STD cout << "string " << YYText() << '\n';
%%
diff --git a/flex.skl b/flex.skl
index 8d5a6b3..8d09042 100644
--- a/flex.skl
+++ b/flex.skl
@@ -205,7 +205,7 @@ struct yy_buffer_state
%-
FILE *yy_input_file;
%+
- STD istream* yy_input_file;
+ FLEX_STD istream* yy_input_file;
%*
char *yy_ch_buf; /* input buffer */
@@ -867,7 +867,7 @@ do_action: /* This label is used only to access EOF actions. */
} /* end of yylex */
%+
-yyFlexLexer::yyFlexLexer( STD istream* arg_yyin, ostream* arg_yyout )
+yyFlexLexer::yyFlexLexer( FLEX_STD istream* arg_yyin, FLEX_STD ostream* arg_yyout )
{
yyin = arg_yyin;
yyout = arg_yyout;