|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elang.evm.ParseNode | +--org.erights.e.elang.evm.ENode | +--org.erights.e.elang.evm.EExpr | +--org.erights.e.elang.evm.DefineExpr
Safe: BNF: "def" pattern ":=" eExpr
Introduce a binding for 'pattern' in the nearest layer of the current environment. 'pattern' must not yet have a binding in this layer.
For a DefineExpr to be well formed, none of the variables defined by pattern (ie, pattern.staticScope().outNames()) may be used by eExpr (ie, eExpr.staticScope().namesUsed()), and vice versa. By imposing this restriction in the kernel language, the kernel language may evaluate these two in the wrong order (right to left) without violating the left to right scoping rule. Therefore, the kernel language remains a valid subset of the user language, in that all kernel programs are valid user programs with the same meaning. A user-level def-expression that violates the above rules is expanded into a kernel-level one that satisfies it.
Field Summary | |
private Pattern |
myPattern
|
private EExpr |
myRValue
|
Fields inherited from class org.erights.e.elang.evm.ENode |
|
Fields inherited from class org.erights.e.elang.evm.ParseNode |
NUM_PR, PR_ASSIGN, PR_CALL, PR_COMP, PR_EEXPR, PR_LISTPATT, PR_ORDER, PR_PATTERN, PR_PRIM, PR_START |
Constructor Summary | |
DefineExpr(SourceSpan optSpan,
Pattern pattern,
EExpr rValue)
Enabled: If the resulting DefineExpr isn't well formed (see class comment), this throws a (XXX to be defined) exception. |
Method Summary | |
protected StaticScope |
computeStaticScope()
When staticScope() is first requested on a given node, it calls computeStaticScope() to do the actual computation, which is then remembered. |
private void |
ensureWellFormed()
|
boolean |
matchBind(ConstList args,
Object specimen,
FlexList bindings)
Enabled: |
Pattern |
pattern()
Enabled: |
EExpr |
rValue()
Enabled: |
protected Object |
subEval(EvalContext ctx,
boolean forValue)
The recursive part that does the work |
void |
subPrintOn(TextWriter out,
int priority)
Enabled: |
Object |
welcome(ETreeVisitor visitor)
Enabled: |
Methods inherited from class org.erights.e.elang.evm.EExpr |
__printOn, appendAllTo, appendTo, eval, eval, evalBool, printAsBlockOn, substitute, transform |
Methods inherited from class org.erights.e.elang.evm.ENode |
cleanCopy, copy, getOptPatternMap, getOptScopeMap, getPatternMap, getScopeMap, qbuild, setPatternMap, setScopeMap, staticScope, synEnv |
Methods inherited from class org.erights.e.elang.evm.ParseNode |
asText, getOptSpan, lnPrintOn, lnPrintOn, matchBind, matchBind, matchBind, printListOn, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final Pattern myPattern
private final EExpr myRValue
Constructor Detail |
public DefineExpr(SourceSpan optSpan, Pattern pattern, EExpr rValue)
Method Detail |
private void ensureWellFormed()
public Object welcome(ETreeVisitor visitor)
welcome
in class ENode
protected StaticScope computeStaticScope()
ENode
computeStaticScope
in class ENode
protected Object subEval(EvalContext ctx, boolean forValue)
EExpr
subEval
in class EExpr
public boolean matchBind(ConstList args, Object specimen, FlexList bindings)
matchBind
in interface MatchMaker
matchBind
in class ParseNode
public Pattern pattern()
public void subPrintOn(TextWriter out, int priority) throws IOException
subPrintOn
in class ParseNode
IOException
public EExpr rValue()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |