Flex-compatible FlexLexer abstract base class template derived from reflex::AbstractMatcher for the reflex-generated yyFlexLexer scanner class. More...
#include <flexlexer.h>
Classes | |
class | Matcher |
Extends reflex::AbstractLexer<M>::Matcher for Flex-compatibility. More... | |
Public Types | |
typedef AbstractLexer< M > | AbstractBaseLexer |
Typedef for the abstract base class. More... | |
Public Member Functions | |
FlexLexer (const Input &input=stdin, std::ostream *os=NULL) | |
Construct Flex-compatible lexer to read from a std::istream (and echo the text matches to a std::ostream). More... | |
const char * | YYText (void) const |
The matched text. More... | |
int | YYLeng (void) const |
The matched text length. More... | |
int | input (void) |
Read one character, returns zero when EOF. More... | |
void | unput (char c) |
Put back one character on the input character sequence for matching, invalidating the current match info and text. More... | |
void | output (char c) |
Output one character. More... | |
virtual void | switch_streams (const Input &input=stdin, std::ostream *os=&std::cout) |
Switch input and output streams. More... | |
virtual int | yywrap (void) |
Default yywrap operation at EOF: do not wrap input. More... | |
virtual int | yylex (void)=0 |
Pure virtual lexer (implemented by a reflex-generated yyFlexLexer). More... | |
![]() | |
AbstractLexer (const Input &input, std::ostream &os) | |
Construct abstract lexer to scan an input character sequence and echo the text matches to output. More... | |
virtual | ~AbstractLexer (void) |
Delete lexer and its current matcher and input. More... | |
virtual void | set_debug (int flag) |
Set debug flag value. More... | |
virtual int | debug (void) const |
Get debug flag value. More... | |
virtual int | wrap (void) |
The default wrap operation at EOF: do not wrap input. More... | |
AbstractLexer & | in (const Input &input) |
Start scanning from the given input character sequence. More... | |
Input & | in (void) |
Returns the current input character sequence that is being scanned. More... | |
AbstractLexer & | out (std::ostream &os) |
Set the current output to the given output stream to echo text matches to. More... | |
std::ostream & | out (void) const |
Returns the current output stream used to echo text matches to. More... | |
bool | has_matcher (void) const |
Returns true if a matcher was assigned to this lexer for scanning. More... | |
AbstractLexer & | matcher (Matcher *matcher) |
Set the matcher (and its current state) for scanning. More... | |
Matcher & | matcher (void) const |
Returns a reference to the current matcher. More... | |
Matcher * | ptr_matcher (void) const |
Returns a pointer to the current matcher, NULL if none was set. More... | |
virtual Matcher * | new_matcher (const Input &input) |
Returns a new matcher for the given input. More... | |
void | del_matcher (Matcher *matcher) |
Delete a matcher. More... | |
void | push_matcher (Matcher *matcher) |
Push the current matcher on the stack and use the given matcher for scanning. More... | |
void | pop_matcher (void) |
Pop matcher from the stack and continue scanning where it left off, delete the current matcher. More... | |
void | echo (void) const |
Echo the matched text to the current output. More... | |
const char * | text (void) const |
Returns string with the text matched. More... | |
size_t | size (void) const |
Returns the matched text size in number of bytes. More... | |
size_t | wsize (void) const |
Returns the matched text size in number of (wide) characters. More... | |
size_t | lineno (void) const |
Returns the line number of matched text. More... | |
size_t | columno (void) const |
Returns the column number of matched text, counting wide characters. More... | |
Protected Member Functions | |
virtual size_t | LexerInput (char *s, size_t n) |
Invoked by FlexLexer::Matcher to read input character sequence. More... | |
virtual void | LexerOutput (const char *s, size_t n) |
Invoked by ECHO and FlexLexer::output. More... | |
virtual void | LexerError (const char *s) |
Invoked by reflex-generated yyFlexLexer when an error occurs. More... | |
void | yy_push_state (int state, void *self=NULL) |
Push the current start condition state on the stack and transition to the given start condition state. More... | |
void | yy_pop_state (void *self=NULL) |
Pop the stack start condition state and transition to that state. More... | |
int | yy_top_state (void) |
Returns the stack top start condition state. More... | |
![]() | |
AbstractLexer & | start (int state) |
Transition to the given start condition state. More... | |
int | start (void) const |
Returns the current start condition state. More... | |
void | push_state (int state) |
Push the current start condition state on the stack and transition to the given start condition state. More... | |
void | pop_state (void) |
Pop the stack start condition state and transition to that state. More... | |
int | top_state (void) const |
Returns the stack top start condition state. More... | |
Additional Inherited Members | |
![]() | |
Matcher * | matcher_ |
the matcher used for scanning More... | |
Input | in_ |
the input character sequence to scan More... | |
std::ostream * | os_ |
the output stream to echo text matches to More... | |
int | start_ |
the current start condition state More... | |
int | debug_ |
1 if -d (–debug) 0 otherwise: More... | |
std::stack< Matcher * > | stack_ |
a stack of pointers to matchers More... | |
std::stack< int > | state_ |
a stack of start condition states More... | |
Flex-compatible FlexLexer abstract base class template derived from reflex::AbstractMatcher for the reflex-generated yyFlexLexer scanner class.
More info TODO
<M> | matcher class derived from reflex::AbstractMatcher |
typedef AbstractLexer<M> reflex::FlexLexer< M >::AbstractBaseLexer |
Typedef for the abstract base class.
|
inline |
Construct Flex-compatible lexer to read from a std::istream (and echo the text matches to a std::ostream).
input | std::istream (stdin by default) to read a character sequence from |
os | echo the text matches to this std::ostream (std::cout by default) |
|
inline |
Read one character, returns zero when EOF.
|
inlineprotectedvirtual |
Invoked by reflex-generated yyFlexLexer when an error occurs.
s | error message |
|
inlineprotectedvirtual |
Invoked by FlexLexer::Matcher to read input character sequence.
s | points to the string buffer to fill with input |
n | size of buffer pointed to by s |
|
inlineprotectedvirtual |
Invoked by ECHO and FlexLexer::output.
s | points to text to output |
n | length of text to output |
|
inline |
Output one character.
c | char to output via LexerOutput |
|
inlinevirtual |
Switch input and output streams.
input | input to read from |
os | echo the text matches to this std::ostream |
|
inline |
Put back one character on the input character sequence for matching, invalidating the current match info and text.
c | character to put back |
|
inlineprotected |
Pop the stack start condition state and transition to that state.
self | reentrant or self |
|
inlineprotected |
Push the current start condition state on the stack and transition to the given start condition state.
state | start condition state to transition to |
self | reentrant or self |
|
inlineprotected |
Returns the stack top start condition state.
|
inline |
The matched text length.
|
pure virtual |
Pure virtual lexer (implemented by a reflex-generated yyFlexLexer).
|
inline |
The matched text.
|
inlinevirtual |
Default yywrap operation at EOF: do not wrap input.