|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elang.scope.Scope
Untamed: A ConstMap (sort of) from names (strings) to Slot
s.
Scopes inherit from each other in a tree, so they can
be used to model nesting lexical environments. The associations in
the most leafward part of a Scope are called "locals".
Field Summary | |
(package private) ScopeMap |
myScopeMap
|
Constructor Summary | |
(package private) |
Scope(ScopeMap map)
|
Method Summary | |
ConstMap |
asMap()
Enabled: |
void |
bindFinal(String name,
Object theValue)
Enabled: The default implementation here just works in terms of bindOuter(). |
UnQuote |
bindings()
Enabled: universalFlag defaults to true |
UnQuote |
bindings(boolean showSafeFlag)
Enabled: Returns a string showing the bindings in this scope in a pleasant, human readable format. |
abstract void |
bindOuter(String name,
Slot slot)
Enabled: A normal Scope returns a Scope just like this one, except for a new local binding 'name' to 'slot'. |
void |
cleanup()
Enabled: Handle any messes left behind after a top-level exception. |
abstract Scope |
diverge(String fqnPrefix)
Enabled: A new Scope object just like this one, except that it's extensible, but not otherwise mutable, and extension (which are only to the innermost contour) do not affect the inner scope. |
Object |
get(String name)
Enabled: Gets the value of the slot associated with name. |
Object |
get(String name,
Object instead)
Enabled: |
abstract String |
getOptFQNPrefix()
Enabled: What prefix should be used to turn relative behavior names into fully qualified names? |
ScopeMap |
getScopeMap()
Enabled: |
abstract Slot |
getSlot(String name)
Enabled: |
static Scope |
in(ENode node,
EvalContext ctx)
Enabled: |
void |
iterate(AssocFunc func)
Enabled: |
private ConstMap |
locals()
|
boolean |
maps(String name)
Enabled: |
abstract EvalContext |
newContext(int numLocals)
Enabled: |
private void |
printBindingsOn(boolean showSafeFlag,
TextWriter out)
|
void |
put(String name,
Object newValue)
Enabled: The default put() is defined in the obvious fashion in terms of getSlot().setValue(newValue). |
abstract NounExpr |
reserveOuterNoun(String name)
Enabled: |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
ScopeMap myScopeMap
Constructor Detail |
Scope(ScopeMap map)
Method Detail |
public static Scope in(ENode node, EvalContext ctx)
public abstract String getOptFQNPrefix()
public abstract EvalContext newContext(int numLocals)
public boolean maps(String name)
name
-
public abstract Slot getSlot(String name)
public Object get(String name)
public Object get(String name, Object instead)
name
- instead
-
public void put(String name, Object newValue)
public ScopeMap getScopeMap()
public abstract NounExpr reserveOuterNoun(String name)
public ConstMap asMap()
public void iterate(AssocFunc func)
iterate
in interface Iteratable
func
- public void bindFinal(String name, Object theValue) throws AlreadyDefinedException
An interactive top-level Scope (a MutableScope) adds a 'name' => 'slot' binding to itself if necessary.
AlreadyDefinedException
public UnQuote bindings() throws IOException
IOException
public UnQuote bindings(boolean showSafeFlag) throws IOException
showSafeFlag
- If set, then unshadowable names from the safe
scope will be shown as well.
IOException
private void printBindingsOn(boolean showSafeFlag, TextWriter out) throws IOException
IOException
public abstract void bindOuter(String name, Slot slot) throws AlreadyDefinedException
If this scope already has a local for 'name', bindOuter() normally throws AlreadyDefinedException. But an interactive top-level Scope (a MutableScope) adds a 'name' => 'slot' binding to itself if necessary. If there already is a local named 'name', bindOuter() replaces it.
AlreadyDefinedException
public abstract Scope diverge(String fqnPrefix)
Unlike the old sprout(), diverge()ing a Scope does not add a new contour, but rather copies the existing innermost contour.
private ConstMap locals()
public void cleanup()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |