#include <lxr.hh>
Public Types | |
| enum | select_type { kChar, kGroup, kDefault, kEOF } |
| enum | flag_bits { kUnget, kNoSave, kReturn } |
| typedef int | state_type |
| typedef char | char_type |
| typedef int | token_type |
| typedef std::vector< transition > | trans_list |
Public Member Functions | |
| lxr (int N) | |
| void | check (bool warn) const |
| void | dump (void) const |
| const transition & | find (int state, char c) const |
| token_type | token (std::istream &in, std::string &tkn) const |
| int | push_state (void) |
| void | addTransition (int state, select_type sel, char_type sel_id, int flags, int next) |
| void | setState0 (int state) |
| void | setTable (const Translate< char > &table) |
Classes | |
| class | transition |
| typedef int lxr::state_type |
State data type
| typedef char lxr::char_type |
Character data type
| typedef int lxr::token_type |
Token data type
| typedef std::vector<transition> lxr::trans_list |
Define transition list data type.
| enum lxr::select_type |
Enumerate selection type
| enum lxr::flag_bits |
Enumerate flag bits.
| lxr::lxr | ( | int | N | ) |
Construct a lxr object. Allocate tables for the specified number of states.
| void lxr::check | ( | bool | warn | ) | const |
Check the state table for undefined states and for ambiguously defined transitions. If an undefined state or ambiguous transition is found, it is reported and an invlid state table exception is thrown. If the warn argument is true, check will also report missing EOF and Default values.
| void lxr::dump | ( | void | ) | const |
Dump out the state transition table.
| const transition& lxr::find | ( | int | state, | |
| char | c | |||
| ) | const |
Find the state transition entry
| token_type lxr::token | ( | std::istream & | in, | |
| std::string & | tkn | |||
| ) | const |
Get the next token. The token type is return as the function value, and the token string is returned to the second argument value.
| int lxr::push_state | ( | void | ) |
Allocate a new state. No transition entries are added.
| void lxr::addTransition | ( | int | state, | |
| select_type | sel, | |||
| char_type | sel_id, | |||
| int | flags, | |||
| int | next | |||
| ) |
Add a transition entry to the table for the specified state.
| void lxr::setState0 | ( | int | state | ) |
Set the initial state number. By default, state 0 is the initial state.
| void lxr::setTable | ( | const Translate< char > & | table | ) |
Set a translation table that defines the group ID for each character.
1.5.4