Synopsis - Synopsis::SymbolLookup::Scope

namespace Synopsis::SymbolLookup
class Scope
File: ../Synopsis/SymbolLookup/Scope.hh

A Scope contains symbol definitions.

Public Typedefs Summary:
SymbolTable::const_iterator symbol_iterator
ScopeTable::const_iterator scope_iterator
unsigned int LookupContext
Public Member functions Summary:
constructor Scope()
Scope* ref()
const Scope* ref() const
void unref() const
virtual const Scope* outer_scope() const
const Scope* global_scope() const
virtual void accept(ScopeVisitor* v)
symbol_iterator symbols_begin() const
symbol_iterator symbols_end() const
scope_iterator scopes_begin() const
scope_iterator scopes_end() const
void declare(const PTree::Encoding& name, const Symbol* symbol)

declare the given symbol in the local scope using the given encoded name.

void declare_scope(const PTree::Node* node, Scope* scope)
virtual void use(const PTree::UsingDirective*)

declare a 'using' directive.

Scope* find_scope(const PTree::Node*) const

find a nested scope by declaration

Scope* find_scope(const PTree::Encoding&, const Symbol*) const

find a nested scope by symbol.

void remove_scope(const PTree::Node*)

Remove the given nested scope from the scope.

SymbolSet find(const PTree::Encoding&, LookupContext) const

find the encoded name declared in this scope and return a set of matching symbols.

void remove(const Symbol* s)

Remove the given symbol from the scope.

SymbolSet lookup(const PTree::Encoding&, LookupContext = DEFAULT) const

look up the encoded name and return a set of matching symbols.

virtual SymbolSet unqualified_lookup(const PTree::Encoding&, LookupContext = DEFAULT) const
virtual SymbolSet qualified_lookup(const PTree::Encoding&, LookupContext = DEFAULT) const
Public Data members Summary:
const LookupContext DEFAULT = 0x0
const LookupContext SCOPE = 0x1
const LookupContext USING = 0x2
const LookupContext ELABORATE = 0x4
const LookupContext DECLARATION = 0x8
Protected Typedefs Summary:
std::multimap<PTree::Encoding, const Symbol*> SymbolTable
std::map<const PTree::Node*, Scope*> ScopeTable
Protected Member functions Summary:
virtual destructor ~Scope()

Scopes are ref counted, and thus are deleted only by 'unref()'

Protected Data members Summary:
SymbolTable my_symbols
ScopeTable my_scopes
size_t my_refcount
Public Member functions Details:
void declare(const PTree::Encoding& name, const Symbol* symbol)

declare the given symbol in the local scope using the given encoded name.

virtual void use(const PTree::UsingDirective*)

declare a 'using' directive. The default implementation raises an exception, as it is only well-formed when the current scope is a function scope or a namespace.

Scope* find_scope(const PTree::Node*) const

find a nested scope by declaration

Scope* find_scope(const PTree::Encoding&, const Symbol*) const

find a nested scope by symbol. The encoded name is provided for diagnostic purposes only.

void remove_scope(const PTree::Node*)

Remove the given nested scope from the scope.

SymbolSet find(const PTree::Encoding&, LookupContext) const

find the encoded name declared in this scope and return a set of matching symbols.

void remove(const Symbol* s)

Remove the given symbol from the scope. s shall not be used after its removal.

SymbolSet lookup(const PTree::Encoding&, LookupContext = DEFAULT) const

look up the encoded name and return a set of matching symbols.

Protected Member functions Details:
virtual destructor ~Scope()

Scopes are ref counted, and thus are deleted only by 'unref()'

Generated on Thu Apr 16 16:27:57 2009 by
synopsis (version devel)