public interface ScriptInterpreter
Modifier and Type | Field and Description |
---|---|
static Object |
MORE_INPUT_PENDING
A special object returned by
interpret(String) when the
interpreter is expecting additional input before finishing the evaluation. |
Modifier and Type | Method and Description |
---|---|
Object |
eval(String command)
Evaluates a command.
|
Bindings |
getBindings()
|
ScriptEngine |
getEngine()
Returns the associated
ScriptEngine . |
ScriptLanguage |
getLanguage()
Returns the associated
ScriptLanguage . |
Object |
interpret(String line)
Interprets the given line of code, which might be part of a multi-line
statement.
|
boolean |
isExpectingMoreInput() |
boolean |
isReady() |
void |
readHistory()
Reads the persisted history of the current script interpreter.
|
void |
reset()
Clears the buffer of not-yet-evaluated lines of code, accumulated from
previous calls to
interpret(java.lang.String) . |
String |
walkHistory(String currentCommand,
boolean forward)
Obtains the next/previous command in the command history.
|
void |
writeHistory()
Persists the history of the current script interpreter.
|
static final Object MORE_INPUT_PENDING
interpret(String)
when the
interpreter is expecting additional input before finishing the evaluation.void readHistory()
void writeHistory()
String walkHistory(String currentCommand, boolean forward)
currentCommand
- the current command (will be stored in the history)forward
- if true, the next history entry is returned (more recent),
if false, the previous oneObject eval(String command) throws ScriptException
command
- the command to evaluateScriptException
Object interpret(String line) throws ScriptException
line
- line of code to interpretMORE_INPUT_PENDING
if there is still
pending inputScriptException
- in case of an exceptionvoid reset()
interpret(java.lang.String)
. In other words: start over with a new
(potentially multi-line) statement, discarding the current partial one.interpret(java.lang.String)
ScriptLanguage getLanguage()
ScriptLanguage
.ScriptEngine getEngine()
ScriptEngine
.Bindings getBindings()
boolean isReady()
interpret(String)
boolean isExpectingMoreInput()
interpret(String)
Copyright © 2015–2022 SciJava. All rights reserved.