|
LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Define symbol class. More...
#include <symbol.hh>


Public Types | |
| typedef unique< std::string, std::less< std::string > > | value_type |
| typedef std::string | data_type |
Public Member Functions | |
Ctor & Dtor. | |
| symbol (const std::string &s) | |
| Construct a symbol. | |
| symbol (const char *s="") | |
| Construct a symbol. | |
| virtual | ~symbol () |
| Destroy a symbol. | |
Operators. | |
| symbol & | operator= (const symbol &rhs) |
| Assign a symbol to this symbol. | |
| bool | operator== (const symbol &rhs) const |
| Compare two symbol for equality. | |
| bool | operator!= (const symbol &rhs) const |
| Compare two symbol for inequality. | |
Operators. | |
| virtual bool | operator== (const value_type &rhs) const |
Compare two unique for equality. | |
| virtual bool | operator!= (const value_type &rhs) const |
Compare two unique for inequality. | |
| virtual bool | operator< (const value_type &rhs) const |
Compare two sunique for order. | |
Static Public Member Functions | |
Factory methods. | |
| static symbol | fresh () |
| Create a new unique symbol. | |
| static symbol | fresh (const symbol &s) |
| Create a new unique symbol, forged from s. | |
Protected Types | |
| typedef std::set< std::string, std::less< std::string > > | object_set_type |
| The unique's object type. | |
| typedef object_set_type::size_type | object_size_type |
| The type for the size of the unique set. | |
Static Protected Member Functions | |
| static object_set_type & | object_set_instance () |
| Return the set of uniques. | |
Protected Attributes | |
| const data_type * | obj_ |
| Pointer to the unique referenced object. | |
Private Types | |
| typedef unique< std::string > | super_type |
| typedef super_type::object_set_type | string_set_type |
| The type "set of strings". | |
| typedef string_set_type::size_type | string_size_type |
| The type for the size of string map. | |
Accessors. | |
| const std::string & | name_get () const |
| Return the string referenced by this. | |
| static string_size_type | string_map_size () |
| Return the number of referenced strings. | |
Accessors. | |
| virtual const data_type & | object_get () const |
Return the object referenced by this. | |
| virtual | operator const data_type & () const |
| static object_size_type | object_map_size () |
| Return the number of referenced objects. | |
Define symbol class.
Map any string to a unique reference. This allows to avoid an "strcmp()" style comparison of strings: reference comparison is much faster.
|
inherited |
|
protectedinherited |
The unique's object type.
|
protectedinherited |
The type for the size of the unique set.
|
private |
The type "set of strings".
|
private |
The type for the size of string map.
|
private |
|
inherited |
| misc::symbol::symbol | ( | const std::string & | s | ) |
| misc::symbol::symbol | ( | const char * | s = "" | ) |
Construct a symbol.
| s | referenced string |
|
virtual |
Destroy a symbol.
|
static |
Create a new unique symbol.
Create a new unique symbol, forged from s.
Counter of unique symbols.
References misc::unique< T, C >::object_get(), str(), and symbol().
| const std::string& misc::symbol::name_get | ( | ) | const |
Return the string referenced by this.
Referenced by assem::ProcFrag::file_name(), object::DesugarVisitor::operator()(), and object::TypeChecker::visit_dec_header().
|
virtualinherited |
Return the object referenced by this.
|
staticinherited |
Return the number of referenced objects.
Referenced by string_map_size().
|
staticprotectedinherited |
Return the set of uniques.
|
virtualinherited |
|
virtualinherited |
Compare two unique for inequality.
| rhs | unique to compare with. |
| bool misc::symbol::operator!= | ( | const symbol & | rhs | ) | const |
Compare two symbol for inequality.
| rhs | string to compare with. |
|
virtualinherited |
Compare two sunique for order.
| rhs | unique to compare with. |
Assign a symbol to this symbol.
| rhs | symbol to copy. |
|
virtualinherited |
Compare two unique for equality.
| rhs | unique to compare with. |
| bool misc::symbol::operator== | ( | const symbol & | rhs | ) | const |
Compare two symbol for equality.
| rhs | string to compare with. |
|
static |
Return the number of referenced strings.
References misc::unique< std::string >::object_map_size().
|
protectedinherited |
Pointer to the unique referenced object.