Package org.eclipse.imp.pdb.facts.type

Examples of org.eclipse.imp.pdb.facts.type.TypeFactory


    }
    return env.abstractDataType(Names.typeName(name), computeTypeParameters(decl, env));
  }

  private Type[] computeTypeParameters(UserType decl, Environment env) {
    TypeFactory tf = TypeFactory.getInstance();

    Type[] params;
    if (decl.isParametric()) {
      java.util.List<org.rascalmpl.ast.Type> formals = decl
          .getParameters();
      params = new Type[formals.size()];
      int i = 0;
      for (org.rascalmpl.ast.Type formal : formals) {
        if (!formal.isVariable()) {
          throw new SyntaxError(
              "Declaration of parameterized type with type instance "
                  + formal + " is not allowed", formal.getLocation());
        }
        TypeVar var = formal.getTypeVar()
        Type bound = var.hasBound() ? var.getBound().typeOf(env, true, eval) : tf
            .valueType();
        params[i++] = tf
            .parameterType(Names.name(var.getName()), bound);
      }
    } else {
      params = new Type[0];
    }
View Full Code Here


    } else {
      for(int j = first; j >= 0 && j > end && j < getValue().arity(); j += increment){
        w.append(getValue().get(j));
      }
    }
    TypeFactory tf = TypeFactory.getInstance();
    return makeResult(tf.listType(tf.valueType()), w.done(), ctx);
  }
View Full Code Here

    });
    return sortedData;
  }
 
  public IList getProfileData(){
    TypeFactory TF = TypeFactory.getInstance();
    Type elemType = TF.tupleType(TF.sourceLocationType(), TF.integerType());
    IValueFactory VF = ValueFactoryFactory.getValueFactory();
    IListWriter w = VF.listWriter(elemType);
    for(Map.Entry<ISourceLocation, Count> e : sortData()){
      w.insert(VF.tuple(e.getKey(), VF.integer(e.getValue().getTicks())));
    }
View Full Code Here

    super(message);
    this.main = main;
  }
 
  public String help(String command) {
    TypeFactory tf = TypeFactory.getInstance();
    StringBuilder b = new StringBuilder();
   
    b.append("Usage: ");
    b.append(command);
   
    Map<String, IValue> kwargs = main.computeKeywordArgs(new IValue[] {}, Collections.<String,IValue>emptyMap());
   
    if (kwargs.size() > 1) {
      b.append(" [options]\n\nOptions:\n");
   
      for (Entry<String, IValue> param : kwargs.entrySet()) {
        b.append("\t-");
        b.append(param.getKey());
        if (param.getValue().getType().isSubtypeOf(tf.boolType())) {
          b.append("\t[arg]: one of nothing (true), \'1\', \'0\', \'true\' or \'false\';\n");
        }
        else {
          b.append("\t[arg]: " + param.getValue().getType() + " argument;\n");
        }
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.type.TypeFactory

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.