org.erights.e.elang.evm
Class Pattern

java.lang.Object
  |
  +--org.erights.e.elang.evm.ParseNode
        |
        +--org.erights.e.elang.evm.ENode
              |
              +--org.erights.e.elang.evm.Pattern
All Implemented Interfaces:
Cloneable, EPrintable, MatchMaker
Direct Known Subclasses:
CdrPattern, IgnorePattern, ListPattern, NounPattern, QuasiLiteralPatt, QuasiPatternPatt, SuchThatPattern

public abstract class Pattern
extends ENode

Untamed: A Pattern 1) "evaluates" in a scope, 2) matches some specimen object, 3) binding names in this scope to values derived (usually extracted) from the specimen, and 4) returns whether the match was successful.

Author:
Mark S. Miller

Field Summary
 
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) Pattern(SourceSpan optSpan)
           
 
Method Summary
 void __printOn(TextWriter out)
          Enabled: @see #subPrintOn
abstract  String optName()
          Enabled: If this pattern is the binding occurence of a name, and it would bind the name to a coercion of the specimen as a whole, return the name.
 Pattern substitute(ConstList args)
          Enabled:
(package private) abstract  void testMatch(EvalContext ctx, Object specimen, OneArgFunc optEjector)
          If this pattern matches the specimen, add macthing bindings to the scope.
 
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, matchBind, printListOn, subPrintOn, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pattern

Pattern(SourceSpan optSpan)
Method Detail

__printOn

public void __printOn(TextWriter out)
               throws IOException
Enabled: @see #subPrintOn

Specified by:
__printOn in interface EPrintable
Overrides:
__printOn in class ParseNode
IOException
See Also:
ParseNode.subPrintOn(org.erights.e.elib.oldeio.TextWriter, int)

substitute

public Pattern substitute(ConstList args)
Enabled:


testMatch

abstract void testMatch(EvalContext ctx,
                        Object specimen,
                        OneArgFunc optEjector)
If this pattern matches the specimen, add macthing bindings to the scope.

Otherwise report the reason why not according to optEjector.


optName

public abstract String optName()
Enabled: If this pattern is the binding occurence of a name, and it would bind the name to a coercion of the specimen as a whole, return the name.

Else return null. The purpose is to support the extraction of fully qualified names for object-definition expressions



comments?