summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormillaway <millaway>2002-11-22 20:38:04 +0000
committermillaway <millaway>2002-11-22 20:38:04 +0000
commitf64d83628b9e36480fd8dd0ebd4c3d8dc0e792a7 (patch)
tree2023971e75c32a9504d5aac85a5d807b7bafbe6f
parent2a62d2d9c30caf5fca434ad876fa30c52b3edc27 (diff)
downloadflex-f64d83628b9e36480fd8dd0ebd4c3d8dc0e792a7.tar.gz
Fixed prefix of yyalloc,yyfree,yyrealloc in C++ scanner.
Removed yylex_destroy from C++ scanner.
-rw-r--r--flex.skl7
-rw-r--r--main.c10
-rw-r--r--tests/test-c++-multiple-scanners/Makefile.am1
3 files changed, 11 insertions, 7 deletions
diff --git a/flex.skl b/flex.skl
index 1a46a02..d2689be 100644
--- a/flex.skl
+++ b/flex.skl
@@ -446,7 +446,6 @@ YY_BUFFER_STATE yy_scan_bytes YY_PARAMS(( yyconst char *bytes, int len YY_PROTO_
%pop
-
void *yyalloc YY_PARAMS(( yy_size_t YY_PROTO_LAST_ARG ));
void *yyrealloc YY_PARAMS(( void *, yy_size_t YY_PROTO_LAST_ARG ));
void yyfree YY_PARAMS(( void * YY_PROTO_LAST_ARG ));
@@ -2084,11 +2083,11 @@ int yylex_init( ptr_yy_globals )
%endif
+%push
+%c-only SNIP! this currently causes conflicts with the c++ scanner
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy YYFARGS0(void)
{
-%push
-%c-only 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;
@@ -2109,9 +2108,9 @@ int yylex_destroy YYFARGS0(void)
/* Destroy the main struct (reentrant only). */
yyfree ( yyscanner YY_CALL_LAST_ARG );
%endif
-%pop
return 0;
}
+%pop
/* Internal utility routines. */
diff --git a/main.c b/main.c
index a168920..c25c48f 100644
--- a/main.c
+++ b/main.c
@@ -421,9 +421,6 @@ void check_options ()
GEN_PREFIX ("get_text");
GEN_PREFIX ("get_lineno");
GEN_PREFIX ("set_lineno");
- GEN_PREFIX ("alloc");
- GEN_PREFIX ("realloc");
- GEN_PREFIX ("free");
outn ("#ifdef YY_BISON_BRIDGE");
GEN_PREFIX ("get_lval");
@@ -434,6 +431,13 @@ void check_options ()
}
+ /* The alloc/realloc/free functions are used internally by the
+ * generated scanner for both and C++.
+ */
+ GEN_PREFIX ("alloc");
+ GEN_PREFIX ("realloc");
+ GEN_PREFIX ("free");
+
if (!reentrant)
GEN_PREFIX ("lineno");
diff --git a/tests/test-c++-multiple-scanners/Makefile.am b/tests/test-c++-multiple-scanners/Makefile.am
index d8da4a6..f6dfedc 100644
--- a/tests/test-c++-multiple-scanners/Makefile.am
+++ b/tests/test-c++-multiple-scanners/Makefile.am
@@ -21,6 +21,7 @@
FLEX = $(top_builddir)/flex
+builddir = @builddir@
EXTRA_DIST = scanner-1.l scanner-2.l main.cpp
CLEANFILES = scanner-1.cpp test-c++-multiple-scanners OUTPUT $(OBJS) scanner-2.cpp