namespace Synopsis::SymbolLookup
class Scope
Scope-inheritance Scopes/Synopsis/SymbolLookup/FunctionScope.html Scopes/Synopsis/SymbolLookup/Class.html Scopes/Synopsis/SymbolLookup/Namespace.html Scopes/Synopsis/SymbolLookup/LocalScope.html Scopes/Synopsis/SymbolLookup/MultiplyDefined.html

A Scope contains symbol definitions.

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

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

 void declare_scope(const PTree::Node*, Scope*)
source code

declare a nested scope

virtual void use(const PTree::UsingDirective*)
source code

declare a 'using' directive.

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

find a nested scope by declaration

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

find a nested scope by symbol.

 void remove_scope(const PTree::Node*)
source code

Remove the given nested scope from the scope.

source code

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

 void remove(const Symbol* s)
references
source code

Remove the given symbol from the scope.

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

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

virtual SymbolSet unqualified_lookup(const PTree::Encoding&, LookupContext = DEFAULT) const
source code
virtual SymbolSet qualified_lookup(const PTree::Encoding&, LookupContext = DEFAULT) const
source code
Public Data members Summary:
const LookupContext DEFAULT = 0x0
references
source code
const LookupContext SCOPE = 0x1
references
source code
const LookupContext USING = 0x2
references
source code
references
source code
references
source code
Protected Typedefs Summary:
std::multimap<PTree::Encoding, const Symbol*> SymbolTable
references
source code

SymbolTable provides a mapping from (encoded) names to Symbols declared in this scope.

std::map<const PTree::Node*, Scope*> ScopeTable
references
source code

ScopeTable provides a mapping from scope nodes to Scopes, which can be used to traverse the scope tree in parallel with the associated parse tree.

Protected Member functions Summary:
virtual destructor ~Scope()
references
source code

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

Protected Data members Summary:
references
source code
references
source code
references
source code
Public Member functions Details:
 void declare(const PTree::Encoding& name, const Symbol* symbol)
source code

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

 void declare_scope(const PTree::Node*, Scope*)
source code

declare a nested scope

virtual void use(const PTree::UsingDirective*)
source code

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
source code

find a nested scope by declaration

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

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

 void remove_scope(const PTree::Node*)
source code

Remove the given nested scope from the scope.

source code

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

 void remove(const Symbol* s)
references
source code

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

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

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

Protected Typedefs Details:
std::multimap<PTree::Encoding, const Symbol*> SymbolTable
references
source code

SymbolTable provides a mapping from (encoded) names to Symbols declared in this scope.

std::map<const PTree::Node*, Scope*> ScopeTable
references
source code

ScopeTable provides a mapping from scope nodes to Scopes, which can be used to traverse the scope tree in parallel with the associated parse tree. As this traversal is also done during the parsing, the scopes can not be const.

Protected Member functions Details:
virtual destructor ~Scope()
references
source code

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