| java.lang.Object oscript.Shell
Shell | public class Shell (Code) | | An extensible read-eval-print shell implementation. Splits the basic
process of read, eval, print and handle errors into individual methods
which can be overriden and extended as needed.
NOTE this could probably be split into an abstract base class which
does not implement
Shell.read and
Shell.print , and hence has no
knowledge of input/output/error streams.
author: Rob Clark (rob@ti.com) author: version: 1.2 |
Shell | public Shell(String prompt, BufferedReader in, PrintWriter out, PrintWriter err)(Code) | | Class Constructor.
Parameters: prompt - the prompt to display before the read Parameters: in - input Parameters: out - output Parameters: err - error output |
handleParseException | public void handleParseException(oscript.parser.ParseException e)(Code) | | Called to handle syntax exceptions. A syntax exception occurs in the
case where the input is not syntatically correct.
Parameters: e - the exception |
handleScriptException | public void handleScriptException(oscript.exceptions.PackagedScriptObjectException e)(Code) | | Called to handle script exceptions. A script exception may be a result
of a logical error, in otherwise syntatically correct input.
Parameters: e - the exception |
print | public void print(Value val)(Code) | | Print the result. This is called to print a result after successfully
evaluating an input.
Parameters: val - the result to print |
prompt | public void prompt()(Code) | | Print the prompt shown to the user to indicate that we are ready for
more input.
|
read | public String read() throws IOException(Code) | | Read a line of input. This handles multi-line input (ie. lines ending
with a \ ) by stripping out the backslash and reading the
next line, until there is a line not terminated by a backslash. Also,
as a convenience, this method appends a semicolon to the end of the
input, if needed.
the input |
|
|