public Object eval( CallStack callstack, Interpreter interpreter ) throws EvalError { throw new InterpreterError( "Don't know how to eval an ambiguous name!" +" Use toObject() if you want an object." ); }
if (callstack.depth() > 1) throw new InterpreterError("Callstack growing: " + callstack); throw new EvalError("Sourced file: " + sourceFileInfo + " internal Error: " + e.getMessage(), node, callstack); } catch (TargetError e) {
throw new InterpreterError( "Callstack growing: "+callstack); error("Internal Error: " + e.getMessage()); e.printStackTrace(); if(!interactive) eof = true;
} catch (InterpreterError e) { throw new ScriptException(e.toString());
throw new InterpreterError( "Callstack growing: "+callstack); throw new EvalError( "Sourced file: "+sourceFileInfo+" internal Error: " + e.getMessage(), node, callstack, e); } catch ( TargetError e ) {
throw new InterpreterError( "Callstack growing: "+callstack); e.printStackTrace(); throw new EvalError( "Sourced file: "+sourceFileInfo+" internal Error: " + e.getMessage(), node, callstack); } catch ( TargetError e ) {
private Object evalSource(Object source, ScriptContext scriptContext) throws ScriptException { bsh.NameSpace contextNameSpace = getEngineNameSpace(scriptContext); Interpreter bsh = getInterpreter(); bsh.setNameSpace(contextNameSpace); bsh.setOut(toPrintStream(scriptContext.getWriter())); bsh.setErr(toPrintStream(scriptContext.getErrorWriter())); try { if (source instanceof Reader) { return bsh.eval((Reader) source); } else { return bsh.eval((String) source); } //} catch (ParseException e) { // explicit parsing error TODO how to handle parse exception ? //throw new ScriptException(e.toString()); //e.getErrorSourceFile(), e.getErrorLineNumber()); } catch (TargetError e) { // The script threw an application level exception // set it as the cause ? ScriptException se = new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber()); se.initCause(e.getTarget()); throw se; } catch (EvalError e) { // The script couldn't be evaluated properly throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber()); } catch (InterpreterError e) { // The interpreter had a fatal problem throw new ScriptException(e.toString()); } }
@Override public Object visit(BSHArrayInitializer node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHArrayInitializer class."); }
throw new InterpreterError( "Callstack growing: "+callstack); error("Internal Error: " + e.getMessage()); if(!interactive) EOF = true;
@Override public Object visit(BSHFormalComment node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHFormalComment class."); }
@Override public Object visit(BSHType node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHType class.", node); }
@Override public Object visit(BSHAmbiguousName node) { throw new InterpreterError( "Don't know how to eval an ambiguous name!" +" Use toObject() if you want an object." ); }
@Override public Object visit(BSHArguments node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHArguments class."); }
@Override public Object visit(BSHLiteral node) { if (node.value == null) throw new InterpreterError("Null in bsh literal: "+node.value); return node.value; }
@Override public Object visit(BSHVariableDeclarator node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHVariableDeclarator class."); }
@Override public Object visit(BSHPrimitiveType node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHPrimitiveType class.", node); }
private Object completeRound( String lastEvalName, String nextEvalName, Object returnObject ) { if ( returnObject == null ) throw new InterpreterError("lastEvalName = "+lastEvalName); this.lastEvalName = lastEvalName; this.evalName = nextEvalName; this.evalBaseObject = returnObject; return returnObject; }
/** Return the primitive value stored in its java.lang wrapper class */ public Object getValue() { if ( value == Special.NULL_VALUE ) return null; if ( value == Special.VOID_TYPE ) throw new InterpreterError("attempt to unwrap void type"); return value; }
private Object completeRound( String lastEvalName, String nextEvalName, Object returnObject ) { if ( returnObject == null ) throw new InterpreterError("lastEvalName = "+lastEvalName); this.lastEvalName = lastEvalName; this.evalName = nextEvalName; this.evalBaseObject = returnObject; return returnObject; }
@Override public Object visit(BSHPrimarySuffix node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHPrimarySuffix class.", node); }