From: Frank P.E. More...
#include <FlexLexer.hpp>
Public Member Functions | |
virtual | ~FlexLexer () |
const char * | YYText () |
int | YYLeng () |
virtual void | yy_switch_to_buffer (struct yy_buffer_state *new_buffer)=0 |
virtual struct yy_buffer_state * | yy_create_buffer (istream *s, int size)=0 |
virtual void | yy_delete_buffer (struct yy_buffer_state *b)=0 |
virtual void | yyrestart (istream *s)=0 |
virtual int | yylex ()=0 |
int | yylex (istream *new_in, ostream *new_out=0) |
virtual void | switch_streams (istream *new_in=0, ostream *new_out=0)=0 |
int | lineno () const |
int | debug () const |
void | set_debug (int flag) |
Protected Attributes | |
char * | yytext |
int | yyleng |
int | yylineno |
int | yy_flex_debug |
From: Frank P.E.
Vanris Subject: Modification of FlexLexer.h
Date: Thu, 17 Jan 2002 14:35:26 -0600
I modified FlexLexer.h a bit.
To prevent a compiler warning (complaining that yylex() was hiding this function) I added in class yyFlexLexer the following:
int yylex( istream* new_in, ostream* new_out = 0 ) { return FlexLexer::yylex(new_in, new_out); }
Also in the class yyFlexLexer I added a protected method:
Function that can be used by subclasses during yylex() virtual int actionHook(void* data = 0) { return data == 0; }
I override this function in a subclass of yyFlexLexer and I use it in the lex file to call my subclass. Any data I have to save (e.g. character count) I can now keep in my own subclass as memberfields instead of global variables in the lex file.
I attached the FlexLexer.h file.
I don't know whether Flex is still maintained since the last tarfile is from July 27th 1997, but I thought I at least pass it on.
Frank Vanris.
Sept 2003: changes by stephan@s11n.net
Oct 2004: changed by stephan@s11n.net
Definition at line 111 of file FlexLexer.hpp.
virtual FlexLexer::~FlexLexer | ( | ) | [inline, virtual] |
Definition at line 113 of file FlexLexer.hpp.
int FlexLexer::debug | ( | ) | const [inline] |
Definition at line 141 of file FlexLexer.hpp.
References yy_flex_debug.
int FlexLexer::lineno | ( | ) | const [inline] |
Definition at line 139 of file FlexLexer.hpp.
References yylineno.
void FlexLexer::set_debug | ( | int | flag | ) | [inline] |
Definition at line 142 of file FlexLexer.hpp.
References yy_flex_debug.
virtual void FlexLexer::switch_streams | ( | istream * | new_in = 0 , |
|
ostream * | new_out = 0 | |||
) | [pure virtual] |
Implemented in compact_data_nodeFlexLexer, funtxt_data_nodeFlexLexer, funxml_data_nodeFlexLexer, parens_data_nodeFlexLexer, simplexml_data_nodeFlexLexer, and wesnoth_data_nodeFlexLexer.
Referenced by yylex().
virtual struct yy_buffer_state* FlexLexer::yy_create_buffer | ( | istream * | s, | |
int | size | |||
) | [read, pure virtual] |
virtual void FlexLexer::yy_delete_buffer | ( | struct yy_buffer_state * | b | ) | [pure virtual] |
virtual void FlexLexer::yy_switch_to_buffer | ( | struct yy_buffer_state * | new_buffer | ) | [pure virtual] |
int FlexLexer::YYLeng | ( | ) | [inline] |
Definition at line 116 of file FlexLexer.hpp.
References yyleng.
int FlexLexer::yylex | ( | istream * | new_in, | |
ostream * | new_out = 0 | |||
) | [inline] |
Reimplemented in compact_data_nodeFlexLexer, funtxt_data_nodeFlexLexer, funxml_data_nodeFlexLexer, parens_data_nodeFlexLexer, simplexml_data_nodeFlexLexer, and wesnoth_data_nodeFlexLexer.
Definition at line 128 of file FlexLexer.hpp.
References switch_streams(), and yylex().
virtual int FlexLexer::yylex | ( | ) | [pure virtual] |
Implemented in compact_data_nodeFlexLexer, funtxt_data_nodeFlexLexer, funxml_data_nodeFlexLexer, parens_data_nodeFlexLexer, simplexml_data_nodeFlexLexer, and wesnoth_data_nodeFlexLexer.
Referenced by yylex().
virtual void FlexLexer::yyrestart | ( | istream * | s | ) | [pure virtual] |
const char* FlexLexer::YYText | ( | ) | [inline] |
Definition at line 115 of file FlexLexer.hpp.
References yytext.
int FlexLexer::yy_flex_debug [protected] |
Definition at line 148 of file FlexLexer.hpp.
Referenced by debug(), and set_debug().
int FlexLexer::yyleng [protected] |
Definition at line 146 of file FlexLexer.hpp.
Referenced by YYLeng().
int FlexLexer::yylineno [protected] |
Definition at line 147 of file FlexLexer.hpp.
Referenced by lineno().
char* FlexLexer::yytext [protected] |
Definition at line 145 of file FlexLexer.hpp.
Referenced by YYText().