Package org.renjin.eval

Examples of org.renjin.eval.EvalException


  public static SEXP doCall(@Current Context context, String what, ListVector arguments, Environment environment) {
    Function function = environment
            .findFunction(context, Symbol.get(what));

    if(function == null) {
      throw new EvalException("Could not find function '%s'", what);
    }

    return doCall(context, function, arguments, environment);
  }
View Full Code Here


          if(!StringVector.isNA(namedValue.getName())) {
            rho.setVariable(Symbol.get(namedValue.getName()), namedValue.getValue());
          }
        }
      } else {
        throw new EvalException("invalid 'environ' argument: " + environment);
      }
    }

    // we need to create a new context for the evaluated code, otherwise sys.parent
    // calls and the like will not be able to access this root environment of the script
View Full Code Here

    }
   
    SEXP value = rho.findVariable(symbol);
   
    if(value == Symbol.UNBOUND_VALUE) {
      throw new EvalException("'missing' can only be used for arguments");
    } else if(value == Symbol.MISSING_ARG) {
      return true;
    } else if(isPromisedMissingArg(value)) {
      return true;
    }
View Full Code Here

  }

  private static boolean isVarArgMissing(Environment rho, int varArgReferenceIndex) {
    SEXP ellipses = rho.findVariable(Symbols.ELLIPSES);
    if(ellipses == Symbol.UNBOUND_VALUE) {
      throw new EvalException("This function does not have a ... argument");
    }
    if(ellipses.length() < varArgReferenceIndex) {
      return true;
    }
    SEXP value = ellipses.getElementAsSEXP(varArgReferenceIndex-1);
View Full Code Here

        String line = text.getElementAsString(i);
        try {
          ExpressionVector result = RParser.parseSource(new StringReader(line + "\n"));
          Iterables.addAll(expressions, result);
        } catch (IOException e) {
          throw new EvalException("I/O Exception occurred during parse: " + e.getMessage());
        }
      }
    } else if(file.inherits("connection")) {
      Connection conn = Connections.getConnection(context, file);
      Reader reader = new InputStreamReader(conn.getInputStream());
View Full Code Here

 
  @Builtin(".Primitive")
  public static PrimitiveFunction getPrimitive(String name) {
    PrimitiveFunction fn = Primitives.getBuiltin(Symbol.get(name));
    if(fn == null) {
      throw new EvalException("No such primitive function");
    }
    return fn;
  }
View Full Code Here

  }

  @Internal
  public static void remove(StringVector names, Environment envir, boolean inherits) {
    if(inherits) {
      throw new EvalException("remove(inherits=TRUE) is not yet implemented");
    }
    for(String name : names) {
      envir.remove(Symbol.get(name));
    }
  }
View Full Code Here

    if(nameExp instanceof Symbol) {
      return (Symbol) nameExp;
    } else if(nameExp instanceof StringVector && nameExp.length() == 1) {
      return Symbol.get( ((StringVector) nameExp).getElementAsString(0) );
    } else {
      throw new EvalException("illegal argument: " + nameExp);
    }
  }
View Full Code Here

    if(nameExp instanceof Symbol) {
      return ((Symbol) nameExp).getPrintName();
    } else if(nameExp instanceof StringVector && nameExp.length() == 1) {
      return ((StringVector) nameExp).getElementAsString(0);
    } else {
      throw new EvalException("illegal argument: " + nameExp);
    }
  }
View Full Code Here

    if(source instanceof Vector) {
      vector = (Vector)source;
    } else if(source instanceof PairList) {
      vector = ((PairList) source).toVector();
    } else {
      throw new EvalException(source.getClass().getName());
    }
    return getSubset(vector, arguments, drop);
  }
View Full Code Here

TOP

Related Classes of org.renjin.eval.EvalException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.