KJB
|
#include <Token_map.h>
Public Types | |
typedef std::string | Key_type |
typedef size_t | Val_type |
typedef boost::bimap< Key_type, Val_type > | Map |
typedef Map::value_type | Key_val_pair |
typedef Map::right_value_type | Val_key_pair |
typedef Map::const_iterator | const_iterator |
Public Member Functions | |
Token_map () | |
construct an empty token map More... | |
virtual | ~Token_map () |
translate key into code More... | |
virtual Val_type | get_code (const Token_map::Key_type &key) |
look up code associated with key, or return UNKNOWN_TOKEN_VAL More... | |
virtual Val_type | encode (const Key_type &key, bool learn=false) |
look up code associated with key, adding it if not found More... | |
virtual const Key_type & | decode (const Val_type &val) |
look up key associated with code More... | |
virtual Val_type | next_val () |
gets the next unused code available (e.g., for UNKNOWN) More... | |
const_iterator | begin () |
const_iterator | end () |
Static Public Attributes | |
static const Val_type | UNKNOWN_TOKEN_VAL = 1 |
Protected Member Functions | |
virtual const Key_type & | unknown_key ()=0 |
Protected Attributes | |
Map | map_ |
Val_type | next_val_ |
Friends | |
std::ostream & | operator<< (std::ostream &os, Token_map &map) |
typedef Map::const_iterator semantics::Token_map::const_iterator |
typedef std::string semantics::Token_map::Key_type |
typedef Map::value_type semantics::Token_map::Key_val_pair |
typedef boost::bimap<Key_type, Val_type> semantics::Token_map::Map |
typedef Map::right_value_type semantics::Token_map::Val_key_pair |
typedef size_t semantics::Token_map::Val_type |
|
inline |
construct an empty token map
|
inlinevirtual |
translate key into code
|
inline |
|
virtual |
look up key associated with code
|
virtual |
look up code associated with key, adding it if not found
|
inline |
|
virtual |
look up code associated with key, or return UNKNOWN_TOKEN_VAL
|
inlinevirtual |
gets the next unused code available (e.g., for UNKNOWN)
|
protectedpure virtual |
Implemented in semantics::Semantic_db, semantics::Lexicon_db, and semantics::Nonterminal_db.
|
friend |
|
protected |
|
protected |
|
static |