The BeanShell script interpreter. An instance of Interpreter can be used to source scripts and evaluate statements or expressions. Here are some examples: Interpeter bsh = new Interpreter(); // Evaluate statements and expressions bsh.eval("foo=Math.sin(0.5)"
| 95 | See the BeanShell User's Manual for more information. |
| 96 | */ |
| 97 | public class Interpreter |
| 98 | implements Runnable, ConsoleInterface,Serializable |
| 99 | { |
| 100 | /* --- Begin static members --- */ |
| 101 | |
| 102 | public static final String VERSION = "2.1.1"; |
| 103 | /* |
| 104 | Debug utils are static so that they are reachable by code that doesn't |
| 105 | necessarily have an interpreter reference (e.g. tracing in utils). |
| 106 | In the future we may want to allow debug/trace to be turned on on |
| 107 | a per interpreter basis, in which case we'll need to use the parent |
| 108 | reference in some way to determine the scope of the command that |
| 109 | turns it on or off. |
| 110 | */ |
| 111 | public static boolean DEBUG, TRACE, LOCALSCOPING; |
| 112 | public static boolean COMPATIBIILTY; |
| 113 | |
| 114 | // This should be per instance |
| 115 | transient static PrintStream debug; |
| 116 | static String systemLineSeparator = "\n"; // default |
| 117 | private static final This SYSTEM_OBJECT = This.getThis(new NameSpace(null, null, "bsh.system"), null); |
| 118 | |
| 119 | static { |
| 120 | staticInit(); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | Strict Java mode |
| 125 | @see #setStrictJava( boolean ) |
| 126 | */ |
| 127 | private boolean strictJava = false; |
| 128 | |
| 129 | /* --- End static members --- */ |
| 130 | |
| 131 | /* --- Instance data --- */ |
| 132 | |
| 133 | transient Parser parser; |
| 134 | NameSpace globalNameSpace; |
| 135 | transient Reader in; |
| 136 | transient PrintStream out; |
| 137 | transient PrintStream err; |
| 138 | ConsoleInterface console; |
| 139 | |
| 140 | /** If this interpeter is a child of another, the parent */ |
| 141 | Interpreter parent; |
| 142 | |
| 143 | /** The name of the file or other source that this interpreter is reading */ |
| 144 | String sourceFileInfo; |
| 145 | |
| 146 | /** by default in interactive mode System.exit() on EOF */ |
| 147 | private boolean exitOnEOF = true; |
| 148 | |
| 149 | protected boolean |
| 150 | evalOnly, // Interpreter has no input stream, use eval() only |
| 151 | interactive; // Interpreter has a user, print prompts, etc. |
| 152 | |
| 153 | /** Control the verbose printing of results for the show() command. */ |
| 154 | private boolean showResults; |
nothing calls this directly
no test coverage detected