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

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


  public IValue createAstFromFile(ISourceLocation loc, IBool collectBindings, IString javaVersion,
      IEvaluatorContext eval) {
    try {
      CompilationUnit cu = getCompilationUnit(loc.getPath(), getFileContents(loc, eval), collectBindings.getValue(), javaVersion);

      TypeStore store = new TypeStore();
      store.extendStore(eval.getHeap().getModule("lang::java::m3::AST").getStore());
      ASTConverter converter = new ASTConverter(store, collectBindings.getValue());

      converter.set(cu);
      converter.set(loc);
      cu.accept(converter);
View Full Code Here


  public IValue createAstFromString(ISourceLocation loc, IString contents, IBool collectBindings, IString javaVersion,
      IEvaluatorContext eval) {
    try {
        CompilationUnit cu = getCompilationUnit(loc.getPath(), contents.getValue().toCharArray(), collectBindings.getValue(), javaVersion);

        TypeStore store = new TypeStore();
        store.extendStore(eval.getHeap().getModule("lang::java::m3::AST").getStore());
        ASTConverter converter = new ASTConverter(store, collectBindings.getValue());

        converter.set(cu);
        converter.set(loc);
        cu.accept(converter);
View Full Code Here

    }
  }

  public IValue readTextValueString(IValue type, IString input, RascalExecutionContext rex) {
    //  TypeStore store = ctx.getCurrentEnvt().getStore();
    TypeStore store = new TypeStore();
    //    ModuleEnvironment pt = ctx.getHeap().getModule("ParseTree");
    //    if(pt != null){
    //      store.importStore(pt.getStore());
    //    }
    Type start = tr.valueToType((IConstructor) type, store);
View Full Code Here

  public IBool eq(IValue x, IValue y) {
    return vf.bool(x.isEqual(y));
  }
 
  public IValue make(IValue type, IString name, IList args) {
    TypeStore store = new TypeStore();
    org.eclipse.imp.pdb.facts.type.Type t = new TypeReifier(vf).valueToType((IConstructor) type, store);
   
    IValue[] children = new IValue[args.length()];
    org.eclipse.imp.pdb.facts.type.Type[] argsTypes = new org.eclipse.imp.pdb.facts.type.Type[args.length()];

    for (int i = 0; i < args.length(); i++) {
      children[i] = args.get(i);
      argsTypes[i] = children[i].getType();
    }
   
    try {
      org.eclipse.imp.pdb.facts.type.Type constructor
      = store.lookupConstructor(t, name.getValue(), TypeFactory.getInstance().tupleType(argsTypes));
     
      if (constructor == null) {
        // TODO: improve error messaging, using specialized exception
        throw RuntimeExceptionFactory.illegalArgument(type, null, null);
      }
View Full Code Here

   
    this.values = values;
  }
 
  public IValue readTextATermFile(IValue type, ISourceLocation loc, IEvaluatorContext ctx){
    TypeStore store = new TypeStore();
    Type start = new TypeReifier(ctx.getValueFactory()).valueToType((IConstructor) type, store);
   
    InputStream in = null;
    try{
      in = ctx.getResolverRegistry().getInputStream(loc.getURI());
View Full Code Here

   * - location
   */
 
  public IValue readRSFRelation(IValue result, IString relName, ISourceLocation loc, IEvaluatorContext ctx){
   
    Type resultType = tr.valueToType((IConstructor) result, new TypeStore());
 
    while (resultType.isAliased()) {
      resultType = resultType.getAliased();
    }
   
View Full Code Here

  //////
 
  private IValue read(IValue resultTypeConstructor, ISourceLocation loc, IBool header, IString separator, IString encoding, IBool printInferedType, IEvaluatorContext ctx) {
    setOptions(header, separator, printInferedType);
    Type resultType = types.valueType();
    TypeStore store = new TypeStore();
    if (resultTypeConstructor != null && resultTypeConstructor instanceof IConstructor) {
      resultType = tr.valueToType((IConstructor)resultTypeConstructor, store);
    }
    Type actualType = resultType;
    while (actualType.isAliased()) {
View Full Code Here

 
  public Result<IValue> typeToValue(Type t, IEvaluatorContext ctx) {
    Environment env = ctx.getCurrentEnvt();
    env.getStore().declareAbstractDataType(Factory.Type);
    env.getStore().declareConstructor(Factory.Type_Reified);
    TypeStore store = constructCompleteTypeStore(env);
   
    Map<IConstructor, IConstructor> definitions = new HashMap<IConstructor, IConstructor>();
    IConstructor symbol = reify(t, definitions, ctx, store);
   
    Map<Type,Type> bindings = new HashMap<Type,Type>();
View Full Code Here

   
    return ResultFactory.makeResult(typeType, result, ctx);
  }
 
  public Type valueToType(IConstructor typeValue) {
    return valueToType(typeValue, new TypeStore());
  }
View Full Code Here

   * Reconstruct a type from a reified type value, but declare all types used first using the given definitions
   * @param typeValue the type value to restore
   * @param definitions the definition
   */
  public Type symbolToType(IConstructor symbol, IMap definitions) {
    TypeStore store = new TypeStore();
    declareAbstractDataTypes(definitions, store);
    return symbolToType(symbol, store);
  }
View Full Code Here

TOP

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

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.