public abstract class Expression extends RuleElement
Modifier and Type | Field and Description |
---|---|
protected int |
charPos |
protected int |
line |
protected Rule |
rule |
protected ParseNode |
token |
protected Type |
type |
Modifier | Constructor and Description |
---|---|
protected |
Expression(Rule rule,
Type type,
ParseNode token)
Create a new expression.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
bind()
verify that variables mentioned in this expression are actually available in the rule
bindings list
|
String |
getPos() |
Type |
getType() |
abstract Object |
interpret(HelperAdapter helper)
evaluate the expression by interpreting the expression tree
|
abstract Type |
typeCheck(Type expected)
ensure that all type references in the expression and its component expressions
can be resolved, that the type of the expression is well-defined and that it is
compatible with the type expected in the context in which it occurs.
|
abstract void |
writeTo(StringWriter stringWriter) |
compile, compileBooleanConversion, compileBox, compileNumericConversion, compileObjectConversion, compilePrimitiveConversion, compileStringConversion, compileTypeConversion, compileUnbox, getBindings, getTypeGroup, rebox, toString
protected Rule rule
protected Type type
protected int charPos
protected int line
protected ParseNode token
public abstract void bind() throws TypeException
TypeException
- if any variable is missing or has the wrong typepublic String getPos()
public Type getType()
public abstract Type typeCheck(Type expected) throws TypeException
typeCheck
in class RuleElement
expected
- the type expected for the expression in the contxet in which it occurs. this
may be void but should not be undefined at the point where type checking is performed.TypeException
- if a type check failure occurspublic abstract Object interpret(HelperAdapter helper) throws ExecuteException
interpret
in class RuleElement
helper
- an execution context associated with the rule which contains a map of
current bindings for rule variables and another map of their declared types both of which
are indexed by variable name. This includes entries for the helper (name "-1"), the
recipient if the trigger method is not static (name "0") and the trigger method arguments
(names "1", ...)ExecuteException
- if an error occurs during executionpublic abstract void writeTo(StringWriter stringWriter)
writeTo
in class RuleElement
Copyright © 2016. All Rights Reserved.