|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.ui.InteractiveShell
A simple interactive shell for evaluating groovy expressions on the command line
Field Summary | |
private java.lang.StringBuffer |
accepted
|
private static java.util.Map |
COMMAND_HELP
|
private static int |
COMMAND_ID_BINDING
|
private static int |
COMMAND_ID_DISCARD
|
private static int |
COMMAND_ID_DISPLAY
|
private static int |
COMMAND_ID_EXECUTE
|
private static int |
COMMAND_ID_EXIT
|
private static int |
COMMAND_ID_EXPLAIN
|
private static int |
COMMAND_ID_HELP
|
private static java.util.Map |
COMMAND_MAPPINGS
|
private static java.lang.String[] |
COMMANDS
|
private java.io.PrintStream |
err
|
private java.lang.Exception |
error
|
private java.io.InputStream |
in
|
private static int |
LAST_COMMAND_ID
|
private int |
line
|
private java.io.PrintStream |
out
|
private SourceUnit |
parser
|
private java.lang.String |
pending
|
private Prompt |
prompt
|
private GroovyShell |
shell
|
private boolean |
stale
|
private TokenStream |
stream
|
private CSTNode |
tree
|
Constructor Summary | |
InteractiveShell()
Default constructor. |
|
InteractiveShell(Binding binding,
java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err)
|
|
InteractiveShell(java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err)
|
Method Summary | |
private void |
accept()
Accepts the pending text into the statement. |
private java.lang.String |
accepted(boolean complete)
Returns the accepted statement as a string. |
protected void |
close()
|
private java.lang.String |
current()
Returns the current statement, including pending text. |
private void |
displayBinding()
Displays the current binding used when instanciating the shell. |
private void |
displayHelp()
Displays help text about available commands. |
private void |
displayStatement()
Displays the accepted statement. |
private void |
explainStatement()
Attempts to parse the accepted statement and display the parse tree for it. |
private void |
freshen()
Clears accepted if stale. |
static void |
main(java.lang.String[] args)
Entry point when called directly. |
private boolean |
parse(java.lang.String code,
int tolerance)
Attempts to parse the specified code with the specified tolerance. |
protected java.lang.String |
read()
Reads a single statement from the command line. |
private void |
report()
Reports the last parsing error to the user. |
protected void |
reset()
Resets the command-line processing machinery after use. |
void |
run(java.lang.String[] args)
Reads commands and statements from input stream and processes them. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final GroovyShell shell
private final Prompt prompt
private final java.io.InputStream in
private final java.io.PrintStream out
private final java.io.PrintStream err
private java.lang.StringBuffer accepted
private java.lang.String pending
private int line
private boolean stale
private SourceUnit parser
private TokenStream stream
private java.lang.Exception error
private CSTNode tree
private static final int COMMAND_ID_EXIT
private static final int COMMAND_ID_HELP
private static final int COMMAND_ID_DISCARD
private static final int COMMAND_ID_DISPLAY
private static final int COMMAND_ID_EXPLAIN
private static final int COMMAND_ID_EXECUTE
private static final int COMMAND_ID_BINDING
private static final int LAST_COMMAND_ID
private static final java.lang.String[] COMMANDS
private static final java.util.Map COMMAND_MAPPINGS
private static final java.util.Map COMMAND_HELP
Constructor Detail |
public InteractiveShell()
public InteractiveShell(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
public InteractiveShell(Binding binding, java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
Method Detail |
public static void main(java.lang.String[] args)
public void run(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
protected void close()
protected void reset()
protected java.lang.String read()
private java.lang.String accepted(boolean complete)
complete
,
returns the empty string.
private java.lang.String current()
private void accept()
private void freshen()
private boolean parse(java.lang.String code, int tolerance)
parser
and error
members
appropriately. Returns true if the text parsed, false otherwise.
The attempts to identify and suppress errors resulting from the
unfinished source text.
private void report()
private void displayHelp()
private void displayStatement()
private void displayBinding()
private void explainStatement()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |