Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Symbol_table Class Reference

A symbol table. More...

#include <symbol_table.h>

Collaboration diagram for Symbol_table:

Collaboration graph
[legend]
List of all members.

Public Types

typedef content_type::const_iterator Sym_it

Public Methods

Sym_it begin () const
Sym_it end () const
 Symbol_table ()
 Create new, empty symbol table. More...

virtual ~Symbol_table ()
void add_symbol (std::string name, std::string::size_type base_len, Symbol *sym)
 Add a symbol. More...

void set_peer (Symbol *orig, Symbol *faelschung)
 Set "peer" of a symbol. More...

Symbol_pair get_symbol (std::string name) const
 Fetch a symbol. More...

void dump (std::ostream &out)
 Dump symbol table to /out/. More...

void clear ()

Static Public Methods

Symbol_table & get_instance ()
bool has_dump_flag (char c)

Static Public Attributes

const char * dump_flags = ""

Private Types

typedef std::map< std::string,
Symbol_pair
content_type

Private Attributes

content_type content

Static Private Attributes

Symbol_table instance

Detailed Description

A symbol table.

Definition at line 101 of file symbol_table.h.


Member Typedef Documentation

typedef std::map<std::string, Symbol_pair> Symbol_table::content_type [private]
 

Definition at line 103 of file symbol_table.h.

Referenced by clear().

typedef content_type::const_iterator Symbol_table::Sym_it
 

Definition at line 106 of file symbol_table.h.

Referenced by begin(), end(), and main().


Constructor & Destructor Documentation

Symbol_table::Symbol_table  
 

Create new, empty symbol table.

Generally, you should use Symbol_table::get_instance() instead of creating new symbol tables.

Definition at line 21 of file symbol_table.cc.

Symbol_table::~Symbol_table   [virtual]
 

Definition at line 27 of file symbol_table.cc.


Member Function Documentation

void Symbol_table::add_symbol std::string    name,
std::string::size_type    base_len,
Symbol   sym
 

Add a symbol.

Throws exception on error.

Definition at line 34 of file symbol_table.cc.

References compile_error(), content, Symbol::is_tagged(), and Symbol::set_name().

Referenced by Namespace_scope::add_symbol(), Class_scope::add_symbol(), and Block_scope::add_symbol().

Sym_it Symbol_table::begin   const [inline]
 

Definition at line 110 of file symbol_table.h.

References content, and Sym_it.

Referenced by main().

void Symbol_table::clear  
 

Definition at line 121 of file symbol_table.cc.

References content, and content_type.

void Symbol_table::dump std::ostream &    out
 

Dump symbol table to /out/.

Definition at line 95 of file symbol_table.cc.

References content.

Referenced by main().

Sym_it Symbol_table::end   const [inline]
 

Definition at line 111 of file symbol_table.h.

References content, and Sym_it.

Referenced by main().

Symbol_table& Symbol_table::get_instance   [inline, static]
 

Definition at line 108 of file symbol_table.h.

Referenced by Namespace_scope::add_symbol(), Class_scope::add_symbol(), Block_scope::add_symbol(), Typedef_declaration_reader::declare_variable(), Type::get_type_symbol(), Class_symbol::lookup_helper(), Namespace_scope::lookup_here(), Block_scope::lookup_here(), main(), and Class_symbol::start_definition().

Symbol_pair Symbol_table::get_symbol std::string    name const
 

Fetch a symbol.

Returns the symbol table entry.

Definition at line 82 of file symbol_table.cc.

References content.

Referenced by Type::get_type_symbol(), Namespace_scope::lookup_here(), and Block_scope::lookup_here().

bool Symbol_table::has_dump_flag char    c [static]
 

Definition at line 109 of file symbol_table.cc.

References dump_flags.

Referenced by Variable_symbol::dump(), Function_signature::dump(), main(), print_annotated_tree(), process(), and Program_from_fd::Program_from_fd().

void Symbol_table::set_peer Symbol   orig,
Symbol   faelschung
 

Set "peer" of a symbol.

This is used for the construction "typedef class A {} B;". In that case, "B" becomes an alternate name for A. Hence, the "untag" slot of the symbol B contains the typedef, the "tag" slot becomes the base type.

Definition at line 71 of file symbol_table.cc.

References content, Symbol::get_name(), and Symbol::is_tagged().

Referenced by Typedef_declaration_reader::declare_variable(), and Class_symbol::start_definition().


Member Data Documentation

content_type Symbol_table::content [private]
 

Definition at line 104 of file symbol_table.h.

Referenced by add_symbol(), begin(), clear(), dump(), end(), get_symbol(), and set_peer().

const char * Symbol_table::dump_flags = "" [static]
 

Definition at line 13 of file symbol_table.cc.

Referenced by has_dump_flag(), and main().

Symbol_table Symbol_table::instance [static, private]
 

Definition at line 10 of file symbol_table.cc.


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 17:36:41 2003 for VFiasco Semantics Compiler by doxygen1.2.15