public abstract class BaseScope extends Object implements Scope
| Modifier and Type | Field and Description |
|---|---|
protected Scope |
enclosingScope |
protected List<Scope> |
nestedScopesNotSymbols
All directly contained scopes, typically LocalScopes within a
LocalScope or a LocalScope within a FunctionSymbol.
|
protected Map<String,Symbol> |
symbols
All symbols defined in this scope; can include classes, functions,
variables, or anything else that is a Symbol impl.
|
| Constructor and Description |
|---|
BaseScope() |
BaseScope(Scope enclosingScope) |
| Modifier and Type | Method and Description |
|---|---|
void |
define(Symbol sym)
Define a symbol in this scope, throw IllegalArgumentException
if sym already defined in this scope.
|
List<Scope> |
getAllNestedScopedSymbols() |
List<? extends Symbol> |
getAllSymbols()
Return all symbols found in all nested scopes.
|
List<Scope> |
getEnclosingPathToRoot()
Return (inclusive) list of all scopes on path to root scope.
|
Scope |
getEnclosingScope()
Scope in which this scope defined.
|
MethodSymbol |
getEnclosingScopeOfType(Class<?> type)
Walk up enclosingScope until we find an object of a specific type.
|
Map<String,? extends Symbol> |
getMembers() |
List<Scope> |
getNestedScopedSymbols()
Return all immediately enclosed scoped symbols in insertion order.
|
List<Scope> |
getNestedScopes()
Return a list of scopes nested within this scope.
|
int |
getNumberOfSymbols()
Number of symbols in this specific scope
|
Scope |
getOuterMostEnclosingScope()
Walk up enclosingScope until we find topmost.
|
Scope |
getParentScope()
Where to look next for symbols if just one parent; superclass or enclosing scope.
|
List<Scope> |
getParentScopes()
Multiple superclass or interface implementations and the like...
|
Symbol |
getSymbol(String name)
Get symbol if name defined within this specific scope
|
Set<String> |
getSymbolNames()
Return the set of names associated with all symbols in the scope.
|
List<? extends Symbol> |
getSymbols()
Return the symbols defined within this scope.
|
void |
nest(Scope scope)
Add a nested scope to this scope; could also be a FunctionSymbol
if your language allows nested functions.
|
Symbol |
resolve(String name)
Look up name in this scope or recursively in parent scope if not here
|
void |
setEnclosingScope(Scope enclosingScope)
What scope encloses this scope.
|
String |
toQualifierString(String separator)
Return scopes from to current with separator in between
|
String |
toScopeStackString(String separator) |
String |
toString() |
String |
toTestString() |
String |
toTestString(String separator,
String scopePathSeparator) |
protected Scope enclosingScope
protected Map<String,Symbol> symbols
public BaseScope()
public BaseScope(Scope enclosingScope)
public Symbol getSymbol(String name)
Scopepublic void setEnclosingScope(Scope enclosingScope)
ScopesetEnclosingScope in interface Scopepublic List<Scope> getNestedScopedSymbols()
ScopeScope.getNestedScopes().getNestedScopedSymbols in interface Scopepublic List<Scope> getNestedScopes()
ScopeScope.getNestedScopedSymbols().
ScopedSymbols come first then all non-ScopedSymbols Scope objects.
Insertion order is used within each sublist.getNestedScopes in interface Scopepublic void nest(Scope scope) throws IllegalArgumentException
nest in interface ScopeIllegalArgumentException - if you pass in a SymbolWithScope.public Symbol resolve(String name)
Scopepublic void define(Symbol sym) throws IllegalArgumentException
ScopeScope.getSymbols() returns the list in definition order.define in interface ScopeIllegalArgumentExceptionpublic Scope getParentScope()
ScopegetParentScope in interface Scopepublic List<Scope> getParentScopes()
ScopegetParentScopes in interface Scopepublic Scope getEnclosingScope()
ScopegetEnclosingScope in interface Scopepublic Scope getOuterMostEnclosingScope()
public MethodSymbol getEnclosingScopeOfType(Class<?> type)
public List<Scope> getEnclosingPathToRoot()
ScopegetEnclosingPathToRoot in interface Scopepublic List<? extends Symbol> getSymbols()
ScopegetSymbols in interface Scopepublic List<? extends Symbol> getAllSymbols()
ScopegetAllSymbols in interface Scopepublic int getNumberOfSymbols()
ScopegetNumberOfSymbols in interface Scopepublic Set<String> getSymbolNames()
ScopegetSymbolNames in interface Scopepublic String toQualifierString(String separator)
ScopetoQualifierString in interface Scopepublic String toTestString()
Copyright © 2016 ANTLR. All Rights Reserved.