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

Method run

src/bsh/Interpreter.java:433–574  ·  view source on GitHub ↗

Run interactively. (printing prompts, etc.)

()

Source from the content-addressed store, hash-verified

431 Run interactively. (printing prompts, etc.)
432 */
433 public void run()
434 {
435 if(evalOnly)
436 throw new RuntimeException("bsh Interpreter: No stream");
437
438 /*
439 We'll print our banner using eval(String) in order to
440 exercise the parser and get the basic expression classes loaded...
441 This ameliorates the delay after typing the first statement.
442 */
443 if ( interactive )
444 try {
445 eval("printBanner();");
446 } catch ( EvalError e ) {
447 println(
448 "BeanShell " + VERSION + " - https://github.com/beanshell/beanshell");
449 }
450
451 // init the callstack.
452 CallStack callstack = new CallStack( globalNameSpace );
453
454 SimpleNode node = null;
455 boolean eof = false;
456 while( !eof )
457 {
458 try
459 {
460 // try to sync up the console
461 System.out.flush();
462 System.err.flush();
463 Thread.yield(); // this helps a little
464
465 if ( interactive )
466 print( getBshPrompt() );
467
468 eof = Line();
469
470 if( get_jjtree().nodeArity() > 0 ) // number of child nodes
471 {
472 if( node != null )
473 node.lastToken.next = null; // prevent OutOfMemoryError
474
475 node = (SimpleNode)(get_jjtree().rootNode());
476
477 if(DEBUG)
478 node.dump(">");
479
480 Object ret = node.eval( callstack, this );
481
482 node.lastToken.next = null; // prevent OutOfMemoryError
483
484 // sanity check during development
485 if ( callstack.depth() > 1 )
486 throw new InterpreterError(
487 "Callstack growing: "+callstack);
488
489 if(ret instanceof ReturnControl)
490 ret = ((ReturnControl)ret).value;

Callers 3

mainMethod · 0.95
runMethod · 0.95
mainMethod · 0.95

Calls 15

evalMethod · 0.95
printlnMethod · 0.95
printMethod · 0.95
getBshPromptMethod · 0.95
LineMethod · 0.95
get_jjtreeMethod · 0.95
dumpMethod · 0.95
evalMethod · 0.95
depthMethod · 0.95
setuMethod · 0.95
errorMethod · 0.95
clearMethod · 0.95

Tested by

no test coverage detected