public abstract class Expression extends ASTNodeImpl implements ASTInfo
Modifier and Type | Method and Description |
---|---|
abstract <T,E extends java.lang.Throwable> |
accept(ExpressionVisitor<T,E> visitor)
Accepts visitor.
|
protected abstract java.lang.Object |
basicInterpret(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Interpret expression.
|
protected com.whitestein.lsps.lang.parser.antlr.ANTLRLangParser |
createANTLRParser() |
protected java.lang.Object |
doInterpret(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Interpretation of expression with debugger support.
|
protected boolean |
evalCondition(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Evaluates expression as boolean expression.
|
protected java.util.List<Expression> |
evaluateToExpressions(Expression[] expressions,
Interpreter interpreter,
InterpreterStackTrace stackTrace) |
protected java.lang.Object |
executeCompiled(Interpreter interpreter,
InterpreterStackTrace stackTrace) |
Compiled |
getCompiled() |
int |
getDebugLine()
Returns the debug line.
|
protected IdentifierAst |
getIdentifierAst(org.antlr.runtime.tree.CommonTree tree) |
java.lang.Object |
getParseTimeConstant()
Returns the value of the expression determined in parse time.
|
protected ASTNode |
getPrimaryRange() |
protected ASTNode |
getPropertySelectorRange() |
protected ASTNode |
getRange(org.antlr.runtime.tree.CommonTree tree) |
Expression |
getResultExpression()
Returns the result expression.
|
java.util.List<Expression> |
getResultExpressions()
Returns the result expression.
|
Type |
getType()
Returns the return type.
|
java.lang.Object |
interpret(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Interpretation of the expression with handling of correct namespace.
|
java.lang.Object |
interpretInCurrentNamespace(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Interpretation of the expression in the current interpreter namespace.
|
boolean |
isCreatingNonModuleContextObjects()
Returns
true if this expression contains closures
or references that reference the enclosing (non-module) context. |
boolean |
isParseTimeConstant()
Returns
true if the value of the expression is known
in parse time. |
boolean |
requiresNewNamespace() |
void |
setCompiled(Compiled compiled) |
java.lang.String |
showInFullText()
Returns the text of this expression enclosed in curly braces in the full
text.
|
java.lang.String |
showInSurroundingText(int surroundingLinesCount)
Returns the text of this expression enclosed in curly braces with defined number of lines before and after.
|
java.lang.String |
showInText()
Returns the text of this expression enclosed in curly braces in the full or surrounding
text.
|
protected java.util.List<Expression> |
toExpressions(java.util.List<?> values) |
getFullText, getLine, getNodeText, getText, toString
contains, getBeginIndex, getEndIndex, getLength
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFullText, getLine, getNodeText, getText
contains, getBeginIndex, getEndIndex, getLength
public Type getType()
public boolean requiresNewNamespace()
true
if the interpretation requires a new namespacepublic int getDebugLine()
ASTInfo
getDebugLine
in interface ASTInfo
public Expression getResultExpression()
this
.this
)public java.util.List<Expression> getResultExpressions()
public boolean isParseTimeConstant()
true
if the value of the expression is known
in parse time. E.g. constant literals, enumerations, types (without free types).true
if the expression value is known during parsinggetParseTimeConstant()
public java.lang.Object getParseTimeConstant()
UnsupportedOperationException
.
Subclasses, which return true
when isParseTimeConstant()
is called, should override this method.isParseTimeConstant()
public boolean isCreatingNonModuleContextObjects()
true
if this expression contains closures
or references that reference the enclosing (non-module) context.
Referencing the top module context is allowed (e.g. module variables).true
if the expression "references" enclosing namespacepublic java.lang.String showInText()
public java.lang.String showInFullText()
public java.lang.String showInSurroundingText(int surroundingLinesCount)
surroundingLinesCount
- public abstract <T,E extends java.lang.Throwable> T accept(ExpressionVisitor<T,E> visitor) throws E extends java.lang.Throwable
T
- E
- visitor
- E
E extends java.lang.Throwable
protected abstract java.lang.Object basicInterpret(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
protected java.lang.Object executeCompiled(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
ErrorException
public final java.lang.Object interpret(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
public final java.lang.Object interpretInCurrentNamespace(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
protected final java.lang.Object doInterpret(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
protected final boolean evalCondition(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
protected final java.util.List<Expression> evaluateToExpressions(Expression[] expressions, Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
ErrorException
protected final java.util.List<Expression> toExpressions(java.util.List<?> values)
public void setCompiled(Compiled compiled)
public Compiled getCompiled()
protected ASTNode getPrimaryRange()
protected ASTNode getPropertySelectorRange()
protected com.whitestein.lsps.lang.parser.antlr.ANTLRLangParser createANTLRParser()
protected ASTNode getRange(org.antlr.runtime.tree.CommonTree tree)
protected IdentifierAst getIdentifierAst(org.antlr.runtime.tree.CommonTree tree)
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.