MCPcopy Index your code
hub / github.com/beanshell/beanshell / Interpreter

Method Interpreter

src/bsh/Interpreter.java:179–227  ·  view source on GitHub ↗

The main constructor. All constructors should now pass through here. @param namespace If namespace is non-null then this interpreter's root namespace will be set to the one provided. If it is null a new one will be created for it. @param parent The parent interpreter if this interprete

(
		Reader in, PrintStream out, PrintStream err, 
		boolean interactive, NameSpace namespace,
		Interpreter parent, String sourceFileInfo )

Source from the content-addressed store, hash-verified

177 reading... used for debugging. May be null.
178 */
179 public Interpreter(
180 Reader in, PrintStream out, PrintStream err,
181 boolean interactive, NameSpace namespace,
182 Interpreter parent, String sourceFileInfo )
183 {
184 //System.out.println("New Interpreter: "+this +", sourcefile = "+sourceFileInfo );
185 parser = new Parser( in );
186 long t1 = 0;
187 if (Interpreter.DEBUG) {
188 t1=System.currentTimeMillis();
189 }
190 this.in = in;
191 this.out = out;
192 this.err = err;
193 this.interactive = interactive;
194 debug = err;
195 this.parent = parent;
196 if ( parent != null )
197 setStrictJava( parent.getStrictJava() );
198 this.sourceFileInfo = sourceFileInfo;
199
200 BshClassManager bcm = BshClassManager.createClassManager( this );
201 if ( namespace == null ) {
202 globalNameSpace = new NameSpace( bcm, "global");
203 initRootSystemObject();
204 } else {
205 globalNameSpace = namespace;
206 try {
207 if ( ! (globalNameSpace.getVariable("bsh") instanceof This)) {
208 initRootSystemObject();
209 }
210 } catch (final UtilEvalError e) {
211 throw new IllegalStateException(e);
212 }
213 }
214
215 // now done in NameSpace automatically when root
216 // The classes which are imported by default
217 //globalNameSpace.loadDefaultImports();
218
219 if ( interactive ) {
220 loadRCFiles();
221 }
222
223 if ( Interpreter.DEBUG ) {
224 long t2=System.currentTimeMillis();
225 Interpreter.debug("Time to initialize interpreter: "+(t2-t1));
226 }
227 }
228
229 public Interpreter(
230 Reader in, PrintStream out, PrintStream err,

Callers

nothing calls this directly

Calls 12

setStrictJavaMethod · 0.95
createClassManagerMethod · 0.95
initRootSystemObjectMethod · 0.95
loadRCFilesMethod · 0.95
debugMethod · 0.95
setConsoleMethod · 0.95
setuMethod · 0.95
getStrictJavaMethod · 0.80
getVariableMethod · 0.80
getInMethod · 0.65
getOutMethod · 0.65
getErrMethod · 0.65

Tested by

no test coverage detected