public Name getName( NameSpace namespace ) { return namespace.getNameResolver( text ); }
public Name getName( NameSpace namespace ) { return namespace.getNameResolver( text ); }
/** Resolve name to an object through this namespace. * @param name the name * @param interpreter the interpreter * @return the object * @throws UtilEvalError the util eval error */ public Object get(final String name, final Interpreter interpreter) throws UtilEvalError { final CallStack callstack = new CallStack(this); return this.getNameResolver(name).toObject(callstack, interpreter); }
/** Resolve name to an object through this namespace. */ public Object get( String name, Interpreter interpreter ) throws UtilEvalError { CallStack callstack = new CallStack( this ); return getNameResolver( name ).toObject( new BshEvaluatingVisitor(callstack, interpreter) ); }
/** Assign the value to the name. name may evaluate to anything assignable. e.g. a variable or field. */ public void set( String name, Object value ) throws EvalError { // map null to Primtive.NULL coming in... if ( value == null ) value = Primitive.NULL; CallStack callstack = new CallStack(); try { if ( Name.isCompound( name ) ) { LHS lhs = globalNameSpace.getNameResolver( name ).toLHS( callstack, this ); lhs.assign( value, false ); } else // optimization for common case globalNameSpace.setVariable( name, value, false ); } catch ( UtilEvalError e ) { throw e.toEvalError( SimpleNode.JAVACODE, callstack ); } }
/** Assign the value to the name. name may evaluate to anything assignable. e.g. a variable or field. */ public void set( String name, Object value ) throws EvalError { // map null to Primtive.NULL coming in... if ( value == null ) value = Primitive.NULL; CallStack callstack = new CallStack(); try { if ( Name.isCompound( name ) ) { LHS lhs = globalNameSpace.getNameResolver( name ).toLHS( new BshEvaluatingVisitor(callstack, this) ); lhs.assign( value, false ); } else // optimization for common case globalNameSpace.setVariable( name, value, false ); } catch ( UtilEvalError e ) { throw e.toEvalError( SimpleNode.JAVACODE, callstack ); } }
clas = getNameResolver( fullname ).toClass(); } catch ( ClassNotFoundException e ) { /* not a class */ } else
/** Unassign the variable name. Name should evaluate to a variable. */ public void unset( String name ) throws EvalError { /* We jump through some hoops here to handle arbitrary cases like unset("bsh.foo"); */ CallStack callstack = new CallStack(); try { LHS lhs = globalNameSpace.getNameResolver( name ).toLHS( callstack, this ); if ( lhs.type != LHS.VARIABLE ) throw new EvalError("Can't unset, not a variable: "+name, SimpleNode.JAVACODE, new CallStack()); lhs.nameSpace.unsetVariable( name ); } catch ( UtilEvalError e ) { throw new EvalError( e.getMessage(), SimpleNode.JAVACODE, new CallStack(), e); } }
clas = this.getNameResolver(fullname).toClass(); } catch (final ClassNotFoundException e) { /* not a class */ } Interpreter.debug(
/** Unassign the variable name. Name should evaluate to a variable. */ public void unset( String name ) throws EvalError { /* We jump through some hoops here to handle arbitrary cases like unset("bsh.foo"); */ CallStack callstack = new CallStack(); try { LHS lhs = globalNameSpace.getNameResolver( name ).toLHS( new BshEvaluatingVisitor(callstack, this) ); if ( lhs.type != LHS.VARIABLE ) throw new EvalError("Can't unset, not a variable: "+name, SimpleNode.JAVACODE, new CallStack() ); //lhs.assign( null, false ); lhs.nameSpace.unsetVariable( name ); } catch ( UtilEvalError e ) { throw new EvalError( e.getMessage(), SimpleNode.JAVACODE, new CallStack() ); } }
Name targetName = namespace.getNameResolver( prefix ); Object obj = targetName.toObject( callstack, interpreter );
Name targetName = namespace.getNameResolver( prefix ); Object obj = targetName.toObject( visitor );