ArrayInitExpression, AssignableExpression, BooleanLiteral, ClassLiteralExpression, MethodExpression, NewExpression, NullLiteral, NumericLiteral, OperExpression, ReturnExpression, StringLiteral, ThrowExpressionpublic abstract class Expression extends RuleElement
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
charPos |
|
protected int |
line |
|
protected Rule |
rule |
|
protected ParseNode |
token |
|
protected Type |
type |
| Modifier | Constructor | Description |
|---|---|---|
protected |
Expression(Rule rule,
Type type,
ParseNode token) |
Create a new expression.
|
| Modifier and Type | Method | 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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompile, getBindings, getTypeGroup, rebox, toStringprotected 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 RuleElementexpected - 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 RuleElementhelper - 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 RuleElementCopyright © 2018. All rights reserved.