void yy_delete_buffer( struct yy_buffer_state* b );
void yyrestart( FLEX_STD istream* s );
- void yypush_buffer_state( struct yy_buffer_state* new_buffer );
- void yypop_buffer_state(void);
+ void yypush_buffer_state( struct yy_buffer_state* new_buffer );
+ void yypop_buffer_state();
virtual int yylex();
- virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out );
+ virtual void switch_streams( FLEX_STD istream* new_in, FLEX_STD ostream* new_out = 0 );
+ virtual int yywrap();
protected:
virtual int LexerInput( char* buf, int max_size );
int yy_did_buffer_switch_on_eof;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
- void yyensure_buffer_stack(void);
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ struct yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
+ void yyensure_buffer_stack(void);
// The following are not always needed, but may be depending
// on use of certain flex features (like REJECT or yymore()).
* after version 2.5.33
** memory leaks removed from the C++ scanner (but the C++ scanner is
-still experimental and may change radically without notice)
+ still experimental and may change radically without notice)
+
+** c++ scanners can now use yywrap
** added new unit test for c++ and yywrap
}
if (!do_yywrap) {
- outn ("\n#define yywrap(n) 1");
+ if (!C_plus_plus) {
+ outn ("\n#define yywrap(n) 1");
+ }
outn ("#define YY_SKIP_YYWRAP");
}
if (C_plus_plus) {
outn ("\n#include <FlexLexer.h>");
+ if (!do_yywrap) {
+ outn("\nint yyFlexLexer::yywrap() { return 1; }");
+ }
+
if (yyclass) {
outn ("int yyFlexLexer::yylex()");
outn ("\t{");
%}
%option 8bit outfile="scanner-2.cpp" prefix="S2_"
-%option nounput nomain noyywrap
+%option nounput nomain
%option warn stack noyy_top_state
%x OFF
<OFF>.|\n yy_pop_state(); return 7;
%%
+int S2_FlexLexer::yywrap()
+{
+ std::cout << "NOW WRAPPING." << std::endl;
+ return 1;
+}