]> granicus.if.org Git - flex/commitdiff
Removed core of yylex_destroy from c++ scanner -- hack!
authorJohn Millaway <john43@users.sourceforge.net>
Thu, 22 Aug 2002 01:11:07 +0000 (01:11 +0000)
committerJohn Millaway <john43@users.sourceforge.net>
Thu, 22 Aug 2002 01:11:07 +0000 (01:11 +0000)
Added -lstdc++ to LDFLAGS (should we have to do this??)

flex.skl
tests/test-c++-basic/Makefile.am
tests/test-c++-basic/scanner.l

index 7af8c628674a484540c65c6751e916d2e07a5bee..a81f1ecc699d9ed0eca71e4c1db5aae566e7c978 100644 (file)
--- a/flex.skl
+++ b/flex.skl
@@ -553,6 +553,7 @@ struct yyguts_t
 static int yy_init_globals YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 %e
 
+%c These go in the .c file only.
 /* This must go here because YYSTYPE and YYLSTYPE are included
  * from bison output in section 1.*/
 #ifdef YY_REENTRANT_BISON_PURE
@@ -561,6 +562,7 @@ static int yy_init_globals YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 #    define yylloc YY_G(yylloc_r)
 #  endif
 #endif /* YY_REENTRANT_BISON_PURE */
+%e
 
 #endif /* end if YY_REENTRANT */
 
@@ -1968,6 +1970,7 @@ int yylex_init( ptr_yy_globals )
 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
 int yylex_destroy  YYFARGS0(void)
 {
+%- SNIP! this currently causes conflicts with the c++ scanner
     /* Destroy the current (main) buffer. */
     yy_delete_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG );
     YY_G(yy_current_buffer) = NULL;
@@ -1989,6 +1992,7 @@ int yylex_destroy  YYFARGS0(void)
     /* Destroy the main struct (reentrant only). */
     yyfree ( yyscanner YY_CALL_LAST_ARG );
 #endif
+%*
     return 0;
 }
 
index ad57cf74dc11709730f203ff9b17657c0c4ce612..9044eaee18f7e097073d919e3c0c1947ed87e312 100644 (file)
@@ -23,13 +23,12 @@ BISON = @BISON@
 FLEX = $(top_builddir)/flex
 
 EXTRA_DIST = scanner.l test.input
-CLEANFILES = scanner.c scanner.h parser.c parser.h test-c++-basic OUTPUT $(OBJS)
-OBJS = scanner.o # parser.o
+CLEANFILES = scanner.cpp scanner.h test-c++-basic OUTPUT $(OBJS)
+OBJS = scanner.o
 
 INCLUDES = -I $(srcdir) -I $(top_srcdir) -I $(top_builddir) -I .
-#LDFLAGS = $(top_srcdir)/libfl.a 
 LFLAGS = -+
-#YFLAGS = --defines --output=parser.c
+LDFLAGS = -lstdc++
 
 testname = test-c++-basic
 
index 4955acb5340bed73c374f117cc3f2b73ad2850cc..48baf006266f7e43707c07aa15682d27048f071a 100644 (file)
 
 %{
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "config.h"
 
 %}
 
 %option 8bit outfile="scanner.cpp" prefix="test"
 %option nounput nomain noyywrap 
-%option warn
+%option warn c++
 
 
 %%
 int main(void);
 
 int
-main ()
+main (void)
 {
-    yyin = stdin;
-    yyout = stdout;
-    yylex();
-    printf("TEST RETURNING OK.\n");
+    yyFlexLexer f;
+    f.switch_streams(&std::cin, &std::cout);
+    f.yylex();
+    std::cout << "TEST RETURNING OK." << std::endl;
     return 0;
 }