|  | reflex::FlexLexer< M > Class Template Reference updated Fri Dec 9 2016 |

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
reflex::FlexLexer< M > Class Template Referenceabstract

Flex-compatible FlexLexer abstract base class template derived from reflex::AbstractMatcher for the reflex-generated yyFlexLexer scanner class. More...

`#include <flexlexer.h>`

Inheritance diagram for reflex::FlexLexer< M >:
[legend]
Collaboration diagram for reflex::FlexLexer< M >:
[legend]

## Classes
class | Matcher
| Extends reflex::AbstractLexer::Matcher for Flex-compatibility. 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...
size_t | YYLeng (void) const
| The matched text length. More...
void | yy_switch_to_buffer (Matcher *m)
| Switch to another matcher (and use its buffer). More...
Matcher * | yy_create_buffer (const Input &input, int)
| Instantiate a new FlexLexer::Matcher and buffer. More...
void | yy_delete_buffer (Matcher *m)
| Delete a matcher. More...
void | yyrestart (const Input &input)
| Restart reading from a stream. More...
void | yypush_buffer_state (Matcher *m)
| Push the current matcher on the stack and use a new matcher for scanning. More...
void | yypop_buffer_state (void)
| Pop matcher from the stack and delete the current matcher. More...
virtual void | switch_streams (const Input &input=stdin, std::ostream *os=&std::cout)
| Switch input and output streams. More...
int | lineno (void) const
| Line number of matched text. 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...
Public Member Functions inherited from reflex::AbstractLexer< M >
| 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 the current matcher. More...
virtual Matcher * | new_matcher (const Input &input)
| Returns a new matcher for the given input. More...
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
| Returns string with the text matched. More...
size_t | size (void) const
| Matched text size (length in bytes). More...
size_t | lineno (void) const
| Line number of matched text. More...
size_t | columno (void) const
| Column number of matched text. 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...
int | yyinput (void)
| Read one character, returns zero when EOF. More...
int | input (void)
| Read one character, returns zero when EOF. More...
void | unput (char c)
| Put one character back onto the input stream to be read again. More...
void | output (char c)
| Output one character. More...
void | yymore (void)
| Append the next matched text to the currently matched text. More...
void | yyless (int n)
| Truncate the yytext length of the match to n characters in length and reposition for next match. 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...
Protected Member Functions inherited from reflex::AbstractLexer< M >
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...

## Protected Attributes
YY_EXTRA_TYPE | yyextra
| Flex-compatible reentrant YY_EXTRA_TYPE yyextra. More...
Protected Attributes inherited from reflex::AbstractLexer< M >
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...

## Detailed Description

### template<typename M>
class reflex::FlexLexer< M >

Flex-compatible FlexLexer abstract base class template derived from reflex::AbstractMatcher for the reflex-generated yyFlexLexer scanner class.

More info TODO

Template Parameters

  <M> | matcher class derived from reflex::AbstractMatcher

## Constructor & Destructor Documentation

template<typename M >

reflex::FlexLexer< M >::FlexLexer | ( | const Input & | input = `stdin`,
|  | std::ostream * | os = `NULL`
| ) |  |
| inline

Construct Flex-compatible lexer to read from a std::istream (and echo the text matches to a std::ostream).

Parameters

  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)

## Member Function Documentation

template<typename M >

int reflex::FlexLexer< M >::input | ( | void |  | ) |
| inline protected

Read one character, returns zero when EOF.

Returns
  the character read.

template<typename M >

virtual void reflex::FlexLexer< M >::LexerError | ( | const char * | s | ) |
| inline protected virtual

Invoked by reflex-generated yyFlexLexer when an error occurs.

template<typename M >

virtual size_t reflex::FlexLexer< M >::LexerInput | ( | char * | s,
|  | size_t | n
| ) |  |
| inline protected virtual

Invoked by FlexLexer::Matcher to read input character sequence.

Returns
  the nonzero number of (less or equal to n) 8-bit characters added to buffer s from the current input, or zero when EOF.

Parameters

  s | points to the string buffer to fill with input
  n | size of buffer pointed to by s

template<typename M >

virtual void reflex::FlexLexer< M >::LexerOutput | ( | const char * | s,
|  | size_t | n
| ) |  |
| inline protected virtual

Invoked by ECHO and FlexLexer::output.

Parameters

  s | points to text to output
  n | length of text to output

template<typename M >

int reflex::FlexLexer< M >::lineno | ( | void |  | ) | const
| inline

Line number of matched text.

template<typename M >

void reflex::FlexLexer< M >::output | ( | char | c | ) |
| inline protected

Output one character.

Parameters

  c | char to output via LexerOutput

template<typename M >

virtual void reflex::FlexLexer< M >::switch_streams | ( | const Input & | input = `stdin`,
|  | std::ostream * | os = `&std::cout`
| ) |  |
| inline virtual

Switch input and output streams.

Parameters

  input | input to read from
  os | echo the text matches to this std::ostream

template<typename M >

void reflex::FlexLexer< M >::unput | ( | char | c | ) |
| inline protected

Put one character back onto the input stream to be read again.

Parameters

  c | char to put back onto the input stream

template<typename M >

Matcher* reflex::FlexLexer< M >::yy_create_buffer | ( | const Input & | input,
|  | int |
| ) |  |
| inline

Instantiate a new FlexLexer::Matcher and buffer.

Returns
  pointer to new FlexLexer::Matcher.

Parameters

  input | read from an input source

template<typename M >

void reflex::FlexLexer< M >::yy_delete_buffer | ( | Matcher * | m | ) |
| inline

Delete a matcher.

Parameters

  m | victim to delete

template<typename M >

void reflex::FlexLexer< M >::yy_pop_state | ( | void * | self = `NULL` | ) |
| inline protected

Pop the stack start condition state and transition to that state.

Parameters

  self | reentrant or self

template<typename M >

void reflex::FlexLexer< M >::yy_push_state | ( | int | state,
|  | void * | self = `NULL`
| ) |  |
| inline protected

Push the current start condition state on the stack and transition to the given start condition state.

Parameters

  state | start condition state to transition to
  self | reentrant or self

template<typename M >

void reflex::FlexLexer< M >::yy_switch_to_buffer | ( | Matcher * | m | ) |
| inline

Switch to another matcher (and use its buffer).

Parameters

  m | the matcher to switch to

template<typename M >

int reflex::FlexLexer< M >::yy_top_state | ( | void |  | ) |
| inline protected

Returns the stack top start condition state.

Returns
  start condition (integer).

template<typename M >

int reflex::FlexLexer< M >::yyinput | ( | void |  | ) |
| inline protected

Read one character, returns zero when EOF.

Returns
  the character read.

template<typename M >

size_t reflex::FlexLexer< M >::YYLeng | ( | void |  | ) | const
| inline

The matched text length.

Returns
  matched text length.

template<typename M >

void reflex::FlexLexer< M >::yyless | ( | int | n | ) |
| inline protected

Truncate the yytext length of the match to n characters in length and reposition for next match.

Parameters

  n | truncated string length

template<typename M >

virtual int reflex::FlexLexer< M >::yylex | ( | void |  | ) |
| pure virtual

Pure virtual lexer (implemented by a reflex-generated yyFlexLexer).

template<typename M >

void reflex::FlexLexer< M >::yymore | ( | void |  | ) |
| inline protected

Append the next matched text to the currently matched text.

template<typename M >

void reflex::FlexLexer< M >::yypop_buffer_state | ( | void |  | ) |
| inline

Pop matcher from the stack and delete the current matcher.

template<typename M >

void reflex::FlexLexer< M >::yypush_buffer_state | ( | Matcher * | m | ) |
| inline

Push the current matcher on the stack and use a new matcher for scanning.

Parameters

  m | new FlexLexer::Matcher for scanning

template<typename M >

void reflex::FlexLexer< M >::yyrestart | ( | const Input & | input | ) |
| inline

Restart reading from a stream.

Parameters

  input | read from an input source

template<typename M >

const char* reflex::FlexLexer< M >::YYText | ( | void |  | ) | const
| inline

The matched text.

Returns
  NUL-terminated string.

template<typename M >

virtual int reflex::FlexLexer< M >::yywrap | ( | void |  | ) |
| inline virtual

Default yywrap operation at EOF: do not wrap input.

Returns
  1 (0 indicates that new input was set and wrap after EOF is OK).

## Member Data Documentation

template<typename M >

YY_EXTRA_TYPE reflex::FlexLexer< M >::yyextra
| protected

Flex-compatible reentrant YY_EXTRA_TYPE yyextra.

The documentation for this class was generated from the following file:

- flexlexer.h