|  | Reflex Class Reference updated Fri Dec 9 2016 |

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Reflex Class Reference

RE/flex scanner generator class, a variation of the classic "lex" tool to generate scanners. More...

`#include <reflex.h>`

## Classes
struct | Code
struct | Rule

## Public Types
typedef std::vector< Code > | Codes
typedef std::vector< Rule > | Rules
typedef std::vector< std::string > | Strings
typedef std::map< std::string, std::string > | Map
typedef size_t | Start
typedef std::set< Start > | Starts
typedef std::map< Start, Codes > | CodesMap
typedef std::map< Start, Rules > | RulesMap

## Public Member Functions
void | main (int argc, char **argv)
| Main program. More...

## Protected Attributes
Map | options
| maps option name (from the options_table) to its option value More...
Map | scripts
| maps Unicode script names to patterns More...
Strings | conditions
| "INITIAL" start condition etc. defined with x name More...
Strings | patterns
| regex patterns for each start condition More...
Starts | inclusive
| inclusive start conditions More...
Map | definitions
| map of {name} to regex More...
RulesMap | rules
| <Start_i>regex_j action for Start i Rule j More...
Codes | section_top
| top{ user code %} in section 1 container More...
Codes | section_class
| class{ class code %} in section 1 container More...
Codes | section_init
| init{ init code %} in section 1 container More...
Codes | section_1
| %{ user code %} in section 1 container More...
CodesMap | section_2
| lexer user code in section 2 container More...
Codes | section_3
| main user code in section 3 container More...
std::string | infile
| input file name More...
std::istream * | in
| input stream with lex spec More...
std::ostream * | out
| output stream More...
std::string | line
| current line read from input More...
size_t | lineno
| current line number at input More...
size_t | linelen
| current line length More...

## Private Member Functions
void | init (int argc, char **argv)
| Reflex initialization. More...
void | parse (void)
| Parse lex specification input. More...
void | parse_section_1 (void)
void | parse_section_2 (void)
void | parse_section_3 (void)
void | include (const std::string &filename)
| Parse include file. More...
void | write (void)
void | write_banner (const char *title)
void | write_prelude (void)
void | write_class (void)
void | write_section_top ()
void | write_section_class ()
void | write_section_init ()
void | write_section_1 ()
void | write_section_3 ()
void | write_code (const Codes &codes)
void | write_code (const Code &code)
void | write_lexer (void)
void | write_main (void)
void | write_stats (void)
void | write_regex (const std::string &regex)
bool | getline (void)
| Fetch next line from the input, return true if ok. More...
bool | skipcomment (size_t &pos)
| Advance pos over white space and comments, return true if ok. More...
bool | as (size_t &pos, const char *s)
| Advance pos to match case-insensitive string s followed by whitespace, return true if OK. More...
bool | ws (size_t &pos)
| Advance pos over whitespace, returns true if OK. More...
bool | eq (size_t &pos)
| Advance pos over '=' and whitespace, return true if OK. More...
bool | nl (size_t &pos)
| Advance pos to end of line while skipping whitespace, return true if end of line. More...
bool | iscode (void)
| Check if current line starts a block of code or a comment. More...
bool | istopcode (void)
| Check if current line starts a block of top code. More...
bool | isclasscode (void)
| Check if current line starts a block of class code. More...
bool | isinitcode (void)
| Check if current line starts a block of init code. More...
std::string | getname (size_t &pos)
| Advance pos over name, return name. More...
std::string | getstring (size_t &pos)
| Advance pos over quoted string, return string. More...
std::string | getregex (size_t &pos)
Starts | getstarts (size_t &pos)
std::string | getcode (size_t &pos)
void | error (const char *message, const char *arg=NULL, size_t at_lineno=0)
void | warning (const char *message, const char *arg=NULL, size_t at_lineno=0)

## Detailed Description

RE/flex scanner generator class, a variation of the classic "lex" tool to generate scanners.

More info TODO

The Lex specification file extension is `.l`, but also `.lex`, `.ll`, `.l++`, `.lxx`, and `.lpp` are in use.

## Member Typedef Documentation

typedef std::vector<Code> Reflex::Codes

typedef std::map<Start,Codes> Reflex::CodesMap

typedef std::map<std::string,std::string> Reflex::Map

typedef std::vector<Rule> Reflex::Rules

typedef std::map<Start,Rules> Reflex::RulesMap

typedef size_t Reflex::Start

typedef std::set<Start> Reflex::Starts

typedef std::vector<std::string> Reflex::Strings

## Member Function Documentation

bool Reflex::as | ( | size_t & | pos,
|  | const char * | s
| ) |  |
| private

Advance pos to match case-insensitive string s followed by whitespace, return true if OK.

bool Reflex::eq | ( | size_t & | pos | ) |
| private

Advance pos over '=' and whitespace, return true if OK.

void Reflex::error | ( | const char * | message,
|  | const char * | arg = `NULL`,
|  | size_t | at_lineno = `0`
| ) |  |
| private

std::string Reflex::getcode | ( | size_t & | pos | ) |
| private

bool Reflex::getline | ( | void |  | ) |
| private

Fetch next line from the input, return true if ok.

std::string Reflex::getname | ( | size_t & | pos | ) |
| private

Advance pos over name, return name.

std::string Reflex::getregex | ( | size_t & | pos | ) |
| private

Reflex::Starts Reflex::getstarts | ( | size_t & | pos | ) |
| private

std::string Reflex::getstring | ( | size_t & | pos | ) |
| private

Advance pos over quoted string, return string.

void Reflex::include | ( | const std::string & | filename | ) |
| private

Parse include file.

void Reflex::init | ( | int | argc,
|  | char ** | argv
| ) |  |
| private

Reflex initialization.

bool Reflex::isclasscode | ( | void |  | ) |
| private

Check if current line starts a block of class code.

bool Reflex::iscode | ( | void |  | ) |
| private

Check if current line starts a block of code or a comment.

bool Reflex::isinitcode | ( | void |  | ) |
| private

Check if current line starts a block of init code.

bool Reflex::istopcode | ( | void |  | ) |
| private

Check if current line starts a block of top code.

void Reflex::main | ( | int | argc,
|  | char ** | argv
| ) |  |

Main program.

bool Reflex::nl | ( | size_t & | pos | ) |
| private

Advance pos to end of line while skipping whitespace, return true if end of line.

void Reflex::parse | ( | void |  | ) |
| private

Parse lex specification input.

void Reflex::parse_section_1 | ( | void |  | ) |
| private

void Reflex::parse_section_2 | ( | void |  | ) |
| private

void Reflex::parse_section_3 | ( | void |  | ) |
| private

bool Reflex::skipcomment | ( | size_t & | pos | ) |
| private

Advance pos over white space and comments, return true if ok.

void Reflex::warning | ( | const char * | message,
|  | const char * | arg = `NULL`,
|  | size_t | at_lineno = `0`
| ) |  |
| private

void Reflex::write | ( | void |  | ) |
| private

void Reflex::write_banner | ( | const char * | title | ) |
| private

void Reflex::write_class | ( | void |  | ) |
| private

void Reflex::write_code | ( | const Codes & | codes | ) |
| private

void Reflex::write_code | ( | const Code & | code | ) |
| private

void Reflex::write_lexer | ( | void |  | ) |
| private

void Reflex::write_main | ( | void |  | ) |
| private

void Reflex::write_prelude | ( | void |  | ) |
| private

void Reflex::write_regex | ( | const std::string & | regex | ) |
| private

void Reflex::write_section_1 | ( | void |  | ) |
| private

void Reflex::write_section_3 | ( | void |  | ) |
| private

void Reflex::write_section_class | ( | void |  | ) |
| private

void Reflex::write_section_init | ( | void |  | ) |
| private

void Reflex::write_section_top | ( | void |  | ) |
| private

void Reflex::write_stats | ( | void |  | ) |
| private

bool Reflex::ws | ( | size_t & | pos | ) |
| private

Advance pos over whitespace, returns true if OK.

## Member Data Documentation

Strings Reflex::conditions
| protected

"INITIAL" start condition etc. defined with x name

Map Reflex::definitions
| protected

map of {name} to regex

std::istream* Reflex::in
| protected

input stream with lex spec

Starts Reflex::inclusive
| protected

inclusive start conditions

std::string Reflex::infile
| protected

input file name

std::string Reflex::line
| protected

current line read from input

size_t Reflex::linelen
| protected

current line length

size_t Reflex::lineno
| protected

current line number at input

Map Reflex::options
| protected

maps option name (from the options_table) to its option value

std::ostream* Reflex::out
| protected

output stream

Strings Reflex::patterns
| protected

regex patterns for each start condition

RulesMap Reflex::rules
| protected

<Start_i>regex_j action for Start i Rule j

Map Reflex::scripts
| protected

maps Unicode script names to patterns

Codes Reflex::section_1
| protected

%{ user code %} in section 1 container

CodesMap Reflex::section_2
| protected

lexer user code in section 2 container

Codes Reflex::section_3
| protected

main user code in section 3 container

Codes Reflex::section_class
| protected

class{ class code %} in section 1 container

Codes Reflex::section_init
| protected

init{ init code %} in section 1 container

Codes Reflex::section_top
| protected

top{ user code %} in section 1 container

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

- reflex.h
- reflex.cpp