public abstract class Expression extends ASTNodeImpl implements ASTInfo
Modifier and Type | Method and Description |
---|---|
abstract <T,E extends Throwable> |
accept(ExpressionVisitor<T,E> visitor)
Accepts visitor.
|
protected abstract Object |
basicInterpret(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Interpret expression.
|
protected com.whitestein.lsps.lang.parser.antlr.ANTLRLangParser |
createANTLRParser() |
protected 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 List<Expression> |
evaluateToExpressions(Expression[] expressions,
Interpreter interpreter,
InterpreterStackTrace stackTrace) |
protected Object |
executeCompiled(Interpreter interpreter,
InterpreterStackTrace stackTrace) |
Compiled |
getCompiled() |
int |
getDebugLine()
Returns the debug line.
|
protected IdentifierAst |
getIdentifierAst(org.antlr.runtime.tree.CommonTree tree) |
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.
|
List<Expression> |
getResultExpressions()
Returns the result expression.
|
Type |
getType()
Returns the return type.
|
Object |
interpret(Interpreter interpreter,
InterpreterStackTrace stackTrace)
Interpretation of the expression with handling of correct namespace.
|
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) |
String |
showInFullText()
Returns the text of this expression enclosed in curly braces in the full
text.
|
String |
showInSurroundingText(int surroundingLinesCount)
Returns the text of this expression enclosed in curly braces with defined number of lines before and after.
|
String |
showInText()
Returns the text of this expression enclosed in curly braces in the full or surrounding
text.
|
protected List<Expression> |
toExpressions(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 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 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 String showInText()
public String showInFullText()
public String showInSurroundingText(int surroundingLinesCount)
surroundingLinesCount
- public abstract <T,E extends Throwable> T accept(ExpressionVisitor<T,E> visitor) throws E extends Throwable
T
- E
- visitor
- E
E extends Throwable
protected abstract Object basicInterpret(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
protected Object executeCompiled(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
ErrorException
public final Object interpret(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
public final Object interpretInCurrentNamespace(Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
interpreter
- stackTrace
- ErrorException
protected final 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 List<Expression> evaluateToExpressions(Expression[] expressions, Interpreter interpreter, InterpreterStackTrace stackTrace) throws ErrorException
ErrorException
protected final List<Expression> toExpressions(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.