|
|||||||||||
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.Pattern | +--org.erights.e.elang.evm.NounPattern | +--org.erights.e.elang.evm.FinalPattern
Safe: BNF: ID ':' expr
The identifier on the left is the defining occurrence of a variable name. The expression on the right is a "value guard expression". The object it evaluates to will be treated as a ValueGuard, and asked to make a value initialized from a specimen, as if:
def value := valueGuard coerce(specimen, XXX)This value is then defined as the value for a variable of this name in the scope starting immediately after this name.
But wait! That scope includes the value guard expression?!? As with the def-expression, this circularity is indeed allowed and correct in the user-level language, but the kernel-level language (ie, the parse node FinalPattern) imposes a well-formedness criterea that allows us to evaluate in the wrong order without effect. A circular user-level final-pattern must be translated into a well-formed kernel-level FinalPattern.
org.erights.e.elang.evm.DefineExpr
,
org.erights.e.elang.evm.VarPattern
Field Summary | |
private EExpr |
myValueGuard
|
Fields inherited from class org.erights.e.elang.evm.NounPattern |
|
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 | |
FinalPattern(SourceSpan optSpan,
String varName,
AtomicExpr noun,
EExpr guardExpr)
Enabled: If 'varName' would shadow a non-shadowable, throw a (XXX to be defined) exception instead. |
|
FinalPattern(SourceSpan optSpan,
String varName,
EExpr guardExpr)
Enabled: |
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. |
EExpr |
getValueGuard()
Enabled: |
(package private) EExpr |
guardExpr()
|
(package private) void |
testMatch(EvalContext ctx,
Object specimen,
OneArgFunc optEjector)
If this pattern matches the specimen, add macthing bindings to the scope. |
Object |
welcome(ETreeVisitor visitor)
Enabled: |
Methods inherited from class org.erights.e.elang.evm.NounPattern |
ensureWellFormed, getNoun, matchBind, optName, subPrintOn |
Methods inherited from class org.erights.e.elang.evm.Pattern |
__printOn, substitute |
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 EExpr myValueGuard
Constructor Detail |
public FinalPattern(SourceSpan optSpan, String varName, AtomicExpr noun, EExpr guardExpr)
If the FinalPattern would not be well-formed, throw a (XXX to be defined) exception instead.
public FinalPattern(SourceSpan optSpan, String varName, EExpr guardExpr)
Method Detail |
public Object welcome(ETreeVisitor visitor)
welcome
in class ENode
protected StaticScope computeStaticScope()
ENode
computeStaticScope
in class ENode
EExpr guardExpr()
guardExpr
in class NounPattern
public EExpr getValueGuard()
void testMatch(EvalContext ctx, Object specimen, OneArgFunc optEjector)
Pattern
Otherwise report the reason why not according to optEjector.
testMatch
in class Pattern
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |