Class BaseExpression
java.lang.Object
com.googlecode.aviator.BaseExpression
- All Implemented Interfaces:
Expression, Serializable
- Direct Known Subclasses:
ClassExpression, InterpretExpression, LiteralExpression
Base expression
- Author:
- dennis
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected AviatorEvaluatorInstanceprotected Map<String, LambdaFunctionBootstrap> protected Stringprotected SymbolTable -
Constructor Summary
ConstructorsConstructorDescriptionBaseExpression(AviatorEvaluatorInstance instance, List<VariableMeta> vars, SymbolTable symbolTable) -
Method Summary
Modifier and TypeMethodDescriptionAdds the specified symbol to the symbol table and returns a reference to the unique symbol.protected voidafterPopulateFullNames(Map<String, VariableMeta> fullNames, Set<String> parentVars) voidvoidcustomWriteObject(ObjectOutputStream output) execute()Execute an expression with an empty environment, returns the result.Execute an expression with an environment, returns the result.protected Objectabstract ObjectexecuteDirectly(Map<String, Object> env) protected EnvReturns the expression string when turn onOptions.TRACE_EVALoption, else returns null.Returns the function names in the expression when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.Returns the source file name.getStringSegements(String lexeme, int lineNo) Returns this expression's all uninitialized global variable full names(contains dot) in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.Returns this expression's all uninitialized global variable names in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.getVars()Created a faster env map(compare variable names by reference).The arguments should be a sequence of pair invalid input: '<'String, Object>.protected Envprotected Envprotected voidsetCompileEnv(Env compileEnv) protected voidsetExpression(String expression) protected voidsetFuncsArgs(Map<Integer, List<FunctionArgument>> funcsArgs) protected voidsetFunctionNames(List<String> functionNames) protected voidsetInstance(AviatorEvaluatorInstance instance) protected voidsetLambdaBootstraps(Map<String, LambdaFunctionBootstrap> lambdaBootstraps) protected voidsetSourceFile(String sourceFile)
-
Field Details
-
FUNC_PARAMS_VAR
- See Also:
-
varNames
-
varFullNames
-
instance
-
symbolTable
-
sourceFile
-
lambdaBootstraps
-
-
Constructor Details
-
BaseExpression
public BaseExpression(AviatorEvaluatorInstance instance, List<VariableMeta> vars, SymbolTable symbolTable)
-
-
Method Details
-
getSourceFile
Description copied from interface:ExpressionReturns the source file name.- Specified by:
getSourceFilein interfaceExpression- Returns:
- the source file name
-
setSourceFile
-
setInstance
-
afterPopulateFullNames
-
getFullNameMetas
-
getStringSegements
-
newEnv
Description copied from interface:ExpressionCreated a faster env map(compare variable names by reference).The arguments should be a sequence of pair invalid input: '<'String, Object>.- Specified by:
newEnvin interfaceExpression- Parameters:
args-- Returns:
- an env map
-
executeDirectly
-
execute
Description copied from interface:ExpressionExecute an expression with an environment, returns the result.- Specified by:
executein interfaceExpression- Parameters:
map- Binding variable environment- Returns:
- the result of execution
-
execute
-
setFuncsArgs
-
getCompileEnv
-
setCompileEnv
-
getExpression
Returns the expression string when turn onOptions.TRACE_EVALoption, else returns null.- Returns:
- expression in string.
-
setExpression
-
addSymbol
Description copied from interface:ExpressionAdds the specified symbol to the symbol table and returns a reference to the unique symbol. If the symbol already exists, the previous symbol reference is returned instead, in order guarantee that symbol references remain unique.- Specified by:
addSymbolin interfaceExpression- Parameters:
name- The symbol name.
-
execute
Description copied from interface:ExpressionExecute an expression with an empty environment, returns the result.- Specified by:
executein interfaceExpression- Returns:
- the result of execution
-
getVariableFullNames
Description copied from interface:ExpressionReturns this expression's all uninitialized global variable full names(contains dot) in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.- Specified by:
getVariableFullNamesin interfaceExpression- Returns:
-
getVars
-
getVariableNames
Description copied from interface:ExpressionReturns this expression's all uninitialized global variable names in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.- Specified by:
getVariableNamesin interfaceExpression- Returns:
- See Also:
-
newEnv
-
genTopEnv
-
newEnv
-
getFunctionNames
Description copied from interface:ExpressionReturns the function names in the expression when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.- Specified by:
getFunctionNamesin interfaceExpression- Returns:
- the function name list
-
setFunctionNames
-
getLambdaBootstraps
-
setLambdaBootstraps
-
newLambda
-
customReadObject
- Throws:
ClassNotFoundExceptionIOException
-
customWriteObject
- Throws:
IOException
-