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 ®ex) |
| 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) |
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.
| 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 |
|
private |
Advance pos to match case-insensitive string s followed by whitespace, return true if OK.
|
private |
Advance pos over '=' and whitespace, return true if OK.
|
private |
|
private |
|
private |
Fetch next line from the input, return true if ok.
|
private |
Advance pos over name, return name.
|
private |
|
private |
|
private |
Advance pos over quoted string, return string.
|
private |
Parse include file.
|
private |
Reflex initialization.
|
private |
Check if current line starts a block of class code.
|
private |
Check if current line starts a block of code or a comment.
|
private |
Check if current line starts a block of init code.
|
private |
Check if current line starts a block of top code.
| void Reflex::main | ( | int | argc, |
| char ** | argv | ||
| ) |
Main program.
|
private |
Advance pos to end of line while skipping whitespace, return true if end of line.
|
private |
Parse lex specification input.
|
private |
|
private |
|
private |
|
private |
Advance pos over white space and comments, return true if ok.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Advance pos over whitespace, returns true if OK.
|
protected |
"INITIAL" start condition etc. defined with x name
|
protected |
map of {name} to regex
|
protected |
input stream with lex spec
|
protected |
inclusive start conditions
|
protected |
input file name
|
protected |
current line read from input
|
protected |
current line length
|
protected |
current line number at input
|
protected |
maps option name (from the options_table) to its option value
|
protected |
output stream
|
protected |
regex patterns for each start condition
|
protected |
maps Unicode script names to patterns
|
protected |
%{ user code %} in section 1 container
|
protected |
lexer user code in section 2 container
|
protected |
main user code in section 3 container
|
protected |
class{ class code %} in section 1 container
|
protected |
init{ init code %} in section 1 container
|
protected |
top{ user code %} in section 1 container