summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/fastwc/wc1.l1
-rw-r--r--examples/fastwc/wc2.l1
-rw-r--r--examples/fastwc/wc3.l1
-rw-r--r--examples/fastwc/wc4.l1
-rw-r--r--examples/fastwc/wc5.l1
-rw-r--r--flex.skl26
-rw-r--r--main.c2
7 files changed, 17 insertions, 16 deletions
diff --git a/examples/fastwc/wc1.l b/examples/fastwc/wc1.l
index d6696bc..0d4fcf2 100644
--- a/examples/fastwc/wc1.l
+++ b/examples/fastwc/wc1.l
@@ -3,6 +3,7 @@
ws [ \t]
nonws [^ \t\n]
+%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
diff --git a/examples/fastwc/wc2.l b/examples/fastwc/wc2.l
index bd63cd4..0da9953 100644
--- a/examples/fastwc/wc2.l
+++ b/examples/fastwc/wc2.l
@@ -4,6 +4,7 @@ ws [ \t]
nonws [^ \t\n]
word {ws}*{nonws}+
+%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
diff --git a/examples/fastwc/wc3.l b/examples/fastwc/wc3.l
index 7c5f2e2..3cc5d57 100644
--- a/examples/fastwc/wc3.l
+++ b/examples/fastwc/wc3.l
@@ -5,6 +5,7 @@ nonws [^ \t\n]
word {ws}*{nonws}+
words {word}{ws}+
+%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
diff --git a/examples/fastwc/wc4.l b/examples/fastwc/wc4.l
index cbe56f6..90c36ee 100644
--- a/examples/fastwc/wc4.l
+++ b/examples/fastwc/wc4.l
@@ -5,6 +5,7 @@ nonws [^ \t\n]
word {ws}*{nonws}+
words {word}{ws}+
+%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
diff --git a/examples/fastwc/wc5.l b/examples/fastwc/wc5.l
index 8fe17b6..c479480 100644
--- a/examples/fastwc/wc5.l
+++ b/examples/fastwc/wc5.l
@@ -5,6 +5,7 @@ nonws [^ \t\n]
word {ws}*{nonws}+
words {word}{ws}+
+%option main noyywrap
%%
int cc = 0, wc = 0, lc = 0;
diff --git a/flex.skl b/flex.skl
index 8d09042..a49f3ba 100644
--- a/flex.skl
+++ b/flex.skl
@@ -22,15 +22,9 @@
#include <stdlib.h>
%+
-
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7)
-#define THROW_NIL throw()
-#define STD std::
-#include <iosfwd>
-#else
-#define THROW_NIL
-#define STD
-#include <iostream.h>
+#ifdef __CPLUSPLUS
+#define FLEX_STD std::
+#include <iostream>
%*
#include <unistd.h>
@@ -690,14 +684,14 @@ YY_DECL
%-
YY_G(yyin) = stdin;
%+
- yyin = &cin;
+ yyin = & FLEX_STD cin;
%*
if ( ! YY_G(yyout) )
%-
YY_G(yyout) = stdout;
%+
- yyout = &cout;
+ yyout = & FLEX_STD cout;
%*
if ( ! YY_G(yy_current_buffer) )
@@ -903,7 +897,7 @@ yyFlexLexer::~yyFlexLexer()
yy_delete_buffer( yy_current_buffer YY_CALL_LAST_ARG);
}
-void yyFlexLexer::switch_streams( STD istream* new_in, ostream* new_out )
+void yyFlexLexer::switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out )
{
if ( new_in )
{
@@ -1298,7 +1292,7 @@ FILE *input_file;
YY_DECL_LAST_ARG
#endif
%+
-void yyFlexLexer::yyrestart( STD istream* input_file )
+void yyFlexLexer::yyrestart( FLEX_STD istream* input_file )
%*
{
if ( ! YY_G(yy_current_buffer) )
@@ -1373,7 +1367,7 @@ int size;
YY_DECL_LAST_ARG
#endif
%+
-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( STD istream* file, int size )
+YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( FLEX_STD istream* file, int size )
%*
{
YY_BUFFER_STATE b;
@@ -1444,7 +1438,7 @@ YY_DECL_LAST_ARG
#ifndef YY_NEVER_INTERACTIVE
extern "C" int isatty YY_PROTO(( int )) THROW_NIL ;
#endif
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, STD istream* file )
+void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, FLEX_STD istream* file )
%*
{
@@ -1701,7 +1695,7 @@ static void yy_fatal_error( yyconst char msg[] )
void yyFlexLexer::LexerError( yyconst char msg[] )
{
- cerr << msg << '\n';
+ FLEX_STD cerr << msg << '\n';
exit( YY_EXIT_FAILURE );
}
%*
diff --git a/main.c b/main.c
index 39dc161..04cf2cc 100644
--- a/main.c
+++ b/main.c
@@ -654,6 +654,7 @@ char **argv;
defs1_offset = prolog_offset = action_offset = action_index = 0;
action_array[0] = '\0';
+ /* Enable C++ if program name ends with '+'. */
program_name = argv[0];
if ( program_name[0] != '\0' &&
@@ -665,6 +666,7 @@ char **argv;
{
arg = argv[0];
+ /* Stop at first non-option. */
if ( arg[0] != '-' || arg[1] == '\0' )
break;