org.erights.e.elang.evm
Class CdrPattern

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.CdrPattern
All Implemented Interfaces:
Cloneable, EPrintable, MatchMaker

public class CdrPattern
extends Pattern

Safe: BNF: listPattern "+" pattern This tries to match a list that's at least listPattern long by matching each sub-pattern against the corresponding listPattern elements, and matching rest-pattern against a list of the rest of the elements.

Author:
Mark S. Miller

Field Summary
private static ClassDesc EListGuard
           
private  Pattern myRest
           
private  ListPattern myStart
           
 
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
CdrPattern(SourceSpan optSpan, ListPattern start, Pattern rest)
          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.
 boolean matchBind(ConstList args, Object specimen, FlexList bindings)
          Enabled:
 String optName()
          Enabled:
 void subPrintOn(TextWriter out, int priority)
          Enabled:
(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.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

EListGuard

private static final ClassDesc EListGuard

myStart

private final ListPattern myStart

myRest

private final Pattern myRest
Constructor Detail

CdrPattern

public CdrPattern(SourceSpan optSpan,
                  ListPattern start,
                  Pattern rest)
Enabled:

Method Detail

welcome

public Object welcome(ETreeVisitor visitor)
Enabled:

Specified by:
welcome in class ENode

computeStaticScope

protected StaticScope computeStaticScope()
Description copied from class: ENode
When staticScope() is first requested on a given node, it calls computeStaticScope() to do the actual computation, which is then remembered.

Specified by:
computeStaticScope in class ENode

matchBind

public boolean matchBind(ConstList args,
                         Object specimen,
                         FlexList bindings)
Enabled:

Specified by:
matchBind in interface MatchMaker
Specified by:
matchBind in class ParseNode

subPrintOn

public void subPrintOn(TextWriter out,
                       int priority)
                throws IOException
Enabled:

Specified by:
subPrintOn in class ParseNode
IOException

testMatch

void testMatch(EvalContext ctx,
               Object specimen,
               OneArgFunc optEjector)
Description copied from class: Pattern
If this pattern matches the specimen, add macthing bindings to the scope.

Otherwise report the reason why not according to optEjector.

Specified by:
testMatch in class Pattern

optName

public String optName()
Enabled:

Specified by:
optName in class Pattern


comments?