public final class SymbolScope
extends java.lang.Object
SymbolScope
class describes scopes that contain symbols.Constructor and Description |
---|
SymbolScope(SymbolScope scope)
Constructs a new scope for the given outer scope.
|
SymbolScope(SymbolScope scope,
Symbol associatedSymbol)
Constructs a new scope for the given outer scope and associated symbol.
|
Modifier and Type | Method and Description |
---|---|
void |
define(Symbol symbol)
Defines the specified symbol in the current scope.
|
Symbol |
getAssociatedSymbol()
Returns symbol associated with the scope (or containing the scope)
or
null it there is not such symbol. |
SymbolScope |
getOuterScope()
Returns the outer scope for the current scope or
null if
there is no outer scope. |
Symbol |
resolve(java.lang.String name)
Searches for a symbol by its name in the current scope and its outer scopes.
|
Symbol |
resolveMember(java.lang.String name)
Searches for a symbol by its name in the current scope only.
|
Symbol |
resolveNested(java.lang.String... names)
Searches for a symbol described by an array containing its name
preceded with names of the scopes the symbol is nested into.
|
java.lang.String |
toString() |
public SymbolScope(SymbolScope scope, Symbol associatedSymbol)
scope
- Outer scope or null
if there is no outer scope.associatedSymbol
- Associated symbol or null
if there is
no associated symbol.public SymbolScope(SymbolScope scope)
scope
- Outer scope or null
if there is no outer scope.public void define(Symbol symbol)
symbol
- Symbol to be defined.java.lang.IllegalArgumentException
- if symbol
is null
;
if a symbol with such a name is already defined in the current scope.public Symbol resolve(java.lang.String name)
null
is returned.name
- Symbol name.null
if it is not defined.public Symbol resolveMember(java.lang.String name)
null
is returned.name
- Symbol name.null
if it is not defined.public Symbol resolveNested(java.lang.String... names)
null
is returned.names
- Array of names.null
if it is not defined.public SymbolScope getOuterScope()
null
if
there is no outer scope.null
if there is no outer scope.public Symbol getAssociatedSymbol()
null
it there is not such symbol.null
it there is not such symbol.public java.lang.String toString()
toString
in class java.lang.Object