< More...
#include <abslexer.h>
Classes | |
class | Matcher |
Extend matcher class M with a member pointing to the instantiating lexer class. More... | |
Public Member Functions | |
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 |
virtual int | wrap (void) |
AbstractLexer & | in (const Input &input) |
Input & | in (void) |
AbstractLexer & | out (std::ostream &os) |
std::ostream & | out (void) const |
bool | has_matcher (void) const |
AbstractLexer & | matcher (Matcher *matcher) |
Matcher & | matcher (void) const |
virtual Matcher * | new_matcher (const Input &input) |
void | del_matcher (Matcher *matcher) const |
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 |
size_t | size (void) const |
size_t | lineno (void) const |
Protected Member Functions | |
AbstractLexer & | start (int state) |
int | start (void) const |
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 |
Protected Attributes | |
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... | |
<
The abstract lexer class template that is the abstract root class of all reflex-generated scanners.
<M> | matcher class derived from reflex::AbstractMatcher |
|
inline |
Construct abstract lexer to scan an input character sequence and echo the text matches to output.
input | reflex::Input character sequence to read from |
os | echo the text matches to this std::ostream or to std::cout |
|
inlinevirtual |
Delete lexer and its current matcher and input.
|
inlinevirtual |
Get debug flag value.
|
inline |
Delete a matcher.
|
inline |
Echo the matched text to the current output.
|
inline |
Returns true if a matcher was assigned to this lexer for scanning.
|
inline |
Start scanning from the given input character sequence.
input | reflex::Input character sequence to scan |
|
inline |
Returns the current input character sequence that is being scanned.
|
inline |
Line number of matched text.
|
inline |
Set the matcher (and its current state) for scanning.
matcher | points to a matcher object |
|
inline |
Returns the current matcher.
|
inlinevirtual |
Returns a new matcher for the given input.
input | reflex::Input character sequence to match |
|
inline |
Set the current output to the given output stream to echo text matches to.
os | output stream to echo text matches to |
|
inline |
Returns the current output stream used to echo text matches to.
|
inline |
Pop matcher from the stack and continue scanning where it left off, delete the current matcher.
|
inlineprotected |
Pop the stack start condition state and transition to that state.
|
inline |
Push the current matcher on the stack and use the given matcher for scanning.
matcher | points to a matcher object |
|
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 |
|
inlinevirtual |
Set debug flag value.
flag | 0 or 1 |
|
inline |
Matched text size (length in bytes).
|
inlineprotected |
Transition to the given start condition state.
state | start condition state to transition to |
|
inlineprotected |
Returns the current start condition state.
|
inline |
Matched text.
|
inlineprotected |
Returns the stack top start condition state.
|
inlinevirtual |
The default wrap operation at EOF: do not wrap input.
|
protected |
1 if -d (–debug) 0 otherwise:
|
protected |
the input character sequence to scan
|
protected |
the matcher used for scanning
|
protected |
the output stream to echo text matches to
|
protected |
a stack of pointers to matchers
|
protected |
the current start condition state
|
protected |
a stack of start condition states