summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FlexLexer.h22
-rw-r--r--flex.skl4
-rw-r--r--main.c13
3 files changed, 25 insertions, 14 deletions
diff --git a/FlexLexer.h b/FlexLexer.h
index 571a6b7..4427def 100644
--- a/FlexLexer.h
+++ b/FlexLexer.h
@@ -35,6 +35,10 @@
// If you want to create multiple lexer classes, you use the -P flag
// to rename each yyFlexLexer to some other xxFlexLexer.
+#include <iostream.h>
+
+struct yy_buffer_state;
+typedef int yy_state_type;
class FlexLexer {
public:
@@ -43,9 +47,11 @@ public:
const char* YYText() { return yytext; }
int YYLeng() { return yyleng; }
- virtual void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) = 0;
- virtual YY_BUFFER_STATE yy_create_buffer( istream* s, int size ) = 0;
- virtual void yy_delete_buffer( YY_BUFFER_STATE b ) = 0;
+ 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;
+ virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
virtual void yyrestart( istream* s ) = 0;
virtual int yylex() = 0;
@@ -88,9 +94,9 @@ public:
delete yy_state_buf;
}
- void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer );
- YY_BUFFER_STATE yy_create_buffer( istream* s, int size );
- void yy_delete_buffer( YY_BUFFER_STATE b );
+ void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
+ struct yy_buffer_state* yy_create_buffer( istream* s, int size );
+ void yy_delete_buffer( struct yy_buffer_state* b );
void yyrestart( istream* s );
virtual int yylex();
@@ -103,7 +109,7 @@ protected:
int yyinput();
void yy_load_buffer_state();
- void yy_init_buffer( YY_BUFFER_STATE b, istream* s );
+ void yy_init_buffer( struct yy_buffer_state* b, istream* s );
yy_state_type yy_get_previous_state();
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
@@ -112,7 +118,7 @@ protected:
istream* yyin; // input source for default LexerInput
ostream* yyout; // output sink for default LexerOutput
- YY_BUFFER_STATE yy_current_buffer;
+ struct yy_buffer_state* yy_current_buffer;
// yy_hold_char holds the character lost when yytext is formed.
char yy_hold_char;
diff --git a/flex.skl b/flex.skl
index 9894dc5..2dd5df8 100644
--- a/flex.skl
+++ b/flex.skl
@@ -6,7 +6,9 @@
#define FLEX_SCANNER
+%-
#include <stdio.h>
+%*
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
@@ -21,7 +23,7 @@
#include <stdlib.h>
%+
-#include <iostream.h>
+class istream;
%*
#include <unistd.h>
diff --git a/main.c b/main.c
index 73981d6..8e9d108 100644
--- a/main.c
+++ b/main.c
@@ -677,13 +677,16 @@ char **argv;
}
if ( (fulltbl || fullspd) && usemecs )
- flexerror( "-f/-F and -Cm don't make sense together" );
+ flexerror( "-Cf/-CF and -Cm don't make sense together" );
if ( (fulltbl || fullspd) && interactive )
- flexerror( "-f/-F and -I are incompatible" );
+ flexerror( "-Cf/-CF and -I are incompatible" );
if ( fulltbl && fullspd )
- flexerror( "-f and -F are mutually exclusive" );
+ flexerror( "-Cf and -CF are mutually exclusive" );
+
+ if ( C_plus_plus && fullspd )
+ flexerror( "Can't use -+ with -CF option" );
if ( ! use_stdout )
{
@@ -830,7 +833,7 @@ void readin()
if ( fullspd )
printf(
"typedef const struct yy_trans_info *yy_state_type;\n" );
- else
+ else if ( ! C_plus_plus )
printf( "typedef int yy_state_type;\n" );
if ( reject )
@@ -845,7 +848,7 @@ void readin()
printf( "extern int yylineno;\n" );
printf( "int yylineno = 1;\n" );
}
- else
+ else if ( ! C_plus_plus )
printf( "FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;\n" );
if ( C_plus_plus )