|
|||||||||||
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
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.FinalPattern
,
org.erights.e.elang.evm.VarPattern
Field Summary | |
private AtomicExpr |
myNoun
|
private String |
myVarName
|
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 | |
(package private) |
NounPattern(SourceSpan optSpan,
String varName,
AtomicExpr noun)
If 'varName' would shadow a non-shadowable, throw a (XXX to be defined) exception instead. |
Method Summary | |
(package private) void |
ensureWellFormed(EExpr guardExpr)
|
NounExpr |
getNoun()
Enabled: |
(package private) abstract EExpr |
guardExpr()
|
boolean |
matchBind(ConstList args,
Object specimen,
FlexList bindings)
Enabled: |
String |
optName()
Enabled: A Definer will never return null for this. |
void |
subPrintOn(TextWriter out,
int priority)
Enabled: |
Methods inherited from class org.erights.e.elang.evm.Pattern |
__printOn, substitute, testMatch |
Methods inherited from class org.erights.e.elang.evm.ENode |
cleanCopy, computeStaticScope, copy, getOptPatternMap, getOptScopeMap, getPatternMap, getScopeMap, qbuild, setPatternMap, setScopeMap, staticScope, synEnv, welcome |
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 String myVarName
private final AtomicExpr myNoun
Constructor Detail |
NounPattern(SourceSpan optSpan, String varName, AtomicExpr noun)
If the FinalPattern would not be well-formed, throw a (XXX to be defined) exception instead.
Method Detail |
void ensureWellFormed(EExpr guardExpr)
public NounExpr getNoun()
public String optName()
optName
in class Pattern
abstract EExpr guardExpr()
public boolean matchBind(ConstList args, Object specimen, FlexList bindings)
matchBind
in interface MatchMaker
matchBind
in class ParseNode
public void subPrintOn(TextWriter out, int priority) throws IOException
subPrintOn
in class ParseNode
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |