public class Evaluator
extends java.lang.Object
eval(java.lang.String) will
affect the state of the evaluator and the following calls. All of the changes to the evaluator are accumulated in the
scope field.| Constructor and Description |
|---|
Evaluator()
Creates a new Evaluator instantiated with default values and functions copied from
DefaultScope. |
Evaluator(Evaluator parent)
Creates a sub-evaluator that can affect the parent evaluator, but any declared variables/functions will not
affect the parent evaluator.
|
Evaluator(Scope scope)
Creates a new Evaluator instantiated with default values and functions copied from
scope. |
| Modifier and Type | Method and Description |
|---|---|
Obj |
eval(AJELexer lexer)
Evaluates a stream of tokens from a lexer.
|
Obj |
eval(java.io.File file)
Evaluates a file.
|
Obj |
eval(java.io.Reader reader)
Evaluates the script read by a reader.
|
Obj |
eval(java.lang.String script)
Evaluates a string.
|
Obj |
getAnswer() |
Scope |
getScope() |
public Evaluator()
DefaultScope.public Evaluator(Scope scope)
scope.scope - The initial Scope values to copy from.public Obj eval(java.lang.String script)
script - The string of AJE expressions.Obj answer to the script.ComputeException - Error during the execution of the expression.SyntaxException - Error during the lexing or parsing process of the expression.public Obj eval(java.io.File file)
file - The file containing AJE expressions.Obj answer to the script.ComputeException - Error during the execution of the expression.SyntaxException - Error during the lexing or parsing process of the expression.public Obj eval(java.io.Reader reader)
reader - The reader instance that reads AJE expressions.Obj answer to the script.ComputeException - Error during the execution of the expression.SyntaxException - Error during the lexing or parsing process of the expression.public Obj eval(AJELexer lexer)
lexer - The lexer object that outputs AJE tokens.Obj answer to the script.ComputeException - Error during the execution of the expression.SyntaxException - Error during the lexing or parsing process of the expression.