]> granicus.if.org Git - flex/commitdiff
commit the backwash from the branch merges
authorWill Estes <wlestes@users.sourceforge.net>
Wed, 19 Sep 2001 19:37:43 +0000 (19:37 +0000)
committerWill Estes <wlestes@users.sourceforge.net>
Wed, 19 Sep 2001 19:37:43 +0000 (19:37 +0000)
examples/fastwc/wc1.l
examples/fastwc/wc2.l
examples/fastwc/wc3.l
examples/fastwc/wc4.l
examples/fastwc/wc5.l
flex.skl
main.c

index d6696bcde696fd08565290a2c2ed991d888abe50..0d4fcf23cdf9f6872a931f53d4128cf7c138c62d 100644 (file)
@@ -3,6 +3,7 @@
 ws    [ \t]
 nonws [^ \t\n]
 
+%option main noyywrap
 %%
        int cc = 0, wc = 0, lc = 0;
 
index bd63cd4908bec0d721c75d45d64ae25f7fd943d1..0da9953b8cf1a0626ef8998188537233eb45d74c 100644 (file)
@@ -4,6 +4,7 @@ ws    [ \t]
 nonws [^ \t\n]
 word  {ws}*{nonws}+
 
+%option main noyywrap
 %%
        int cc = 0, wc = 0, lc = 0;
 
index 7c5f2e271773bea421eb662afb322bf2eabb07d3..3cc5d579b4665ae3bf2e64d8d3e081369871cf5a 100644 (file)
@@ -5,6 +5,7 @@ nonws [^ \t\n]
 word  {ws}*{nonws}+
 words {word}{ws}+
 
+%option main noyywrap
 %%
        int cc = 0, wc = 0, lc = 0;
 
index cbe56f6e16ba6150b23357aa0ab16181dcbca4f4..90c36eed2cc48cc30f7a069d6d5c1467c7029b04 100644 (file)
@@ -5,6 +5,7 @@ nonws [^ \t\n]
 word  {ws}*{nonws}+
 words {word}{ws}+
 
+%option main noyywrap
 %%
        int cc = 0, wc = 0, lc = 0;
 
index 8fe17b622ed5d6f78baf727a1fc5d59fc9f1577b..c479480c32de7ca4695eb3b8b2ea8c31ac97255e 100644 (file)
@@ -5,6 +5,7 @@ nonws [^ \t\n]
 word  {ws}*{nonws}+
 words {word}{ws}+
 
+%option main noyywrap
 %%
        int cc = 0, wc = 0, lc = 0;
 
index 8d090421a531cf2e1b1aab0957cf219357f3e89a..a49f3ba43752e941d9fd450f6f6f426616e7aad8 100644 (file)
--- a/flex.skl
+++ b/flex.skl
 
 #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 39dc1610a089d7dc185b13766690d09e93e4428b..04cf2cc7cc219ee43493ae43179d21fdcef9ee00 100644 (file)
--- 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;