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

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


    this.vf = vf;
  }
 
  public IValue typeToValue(Type t, RascalExecutionContext rex) {
   
    TypeStore store = new TypeStore();
    IMap definitions = rex.getSymbolDefinitions();
    TypeReifier tr = new TypeReifier(vf);
    tr.declareAbstractDataTypes(definitions, store);
   
    IConstructor symbol = typeToSymbol(t, store);
View Full Code Here


    String tagStr = tag.getValue();
    Type t = handler.getResourceType(ctx, uriLoc);
    PrintWriter currentOutStream = ctx.getStdOut();
   
    // Declare an alias to the type of the resource
    TypeStore ts = ctx.getCurrentEnvt().getStore();
    Type alias2t = TypeFactory.getInstance().aliasType(ts, tagStr + "Type", t);
   
    currentOutStream.println("Generated type alias " + alias2t.toString() + ": " + alias2t.getAliased().toString());
    currentOutStream.flush();
   
View Full Code Here

    return new ArrayList<Type>();
  }

  protected Type makeOptionalParameterType(Type t) {
    TypeFactory tf = TypeFactory.getInstance();
    TypeStore ts = new TypeStore();

    Type paramType = tf.parameterType("T");
    Type adtType = tf.abstractDataType(ts, "Option", paramType);
    Map<Type,Type> bindings = new HashMap<Type,Type>();
    bindings.put(paramType, t);
View Full Code Here

  //////
 
  private IValue read(IValue resultTypeConstructor, ISourceLocation loc, IBool header, IString separator, IString encoding, RascalExecutionContext rex) {
    setOptions(header, separator);
    Type resultType = types.valueType();
    TypeStore store = new TypeStore();
    if (resultTypeConstructor != null && resultTypeConstructor instanceof IConstructor) {
      resultType = tr.valueToType((IConstructor)resultTypeConstructor, store);
    }
    System.err.println("resultTypeConstructor = " + resultTypeConstructor);
    System.err.println("resultType = " + resultType);
View Full Code Here

    } catch (Exception e) {
      throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
    }
  }
  public IValue fromJSON(IValue type, IString src, IEvaluatorContext ctx) {
    TypeStore store = ctx.getCurrentEnvt().getStore();
    Type start = new TypeReifier(ctx.getValueFactory()).valueToType((IConstructor) type, store);
    Gson gson = new GsonBuilder()
    .enableComplexMapKeySerialization()
    .setDateFormat(DateFormat.LONG)
    .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
View Full Code Here

    this.values = values;
    this.tr = new TypeReifier(values);
  }

  public IValue fromJSON(IValue type, IString src, RascalExecutionContext rex) {
    TypeStore store = new TypeStore();
   
    IConstructor type_cons = ((IConstructor) type);
    IMap definitions = rex.getSymbolDefinitions();

    tr.declareAbstractDataTypes(definitions, store);
View Full Code Here

          return ResultFactory
              .makeResult(node.getFieldType(index), cons.get(index),
                  __eval);
        }
      } else if (receiverType.isSourceLocation()) {
        return receiver.fieldAccess(label, new TypeStore());
      } else {
        throw new UndeclaredField(label, receiverType, this);
      }

    }
View Full Code Here

      }
    }
  }
 
  public IValue createM3FromJarClass(ISourceLocation jarLoc, IEvaluatorContext eval) {
      TypeStore store = new TypeStore();
      store.extendStore(eval.getHeap().getModule("lang::java::m3::Core").getStore());
      store.extendStore(eval.getHeap().getModule("lang::java::m3::AST").getStore());
      JarConverter converter = new JarConverter(store);
      converter.set(jarLoc);
      converter.convert(jarLoc, eval);

      return converter.getModel(false);
View Full Code Here

  public IValue createM3FromFile(ISourceLocation loc, IString javaVersion, IEvaluatorContext eval) {
    try {
      CompilationUnit cu = this.getCompilationUnit(loc.getPath(), getFileContents(loc, eval), true, javaVersion);

      TypeStore store = new TypeStore();
      store.extendStore(eval.getHeap().getModule("lang::java::m3::Core").getStore());
      store.extendStore(eval.getHeap().getModule("lang::java::m3::AST").getStore());
      SourceConverter converter = new SourceConverter(store);

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

 
  public IValue createM3FromString(ISourceLocation loc, IString contents, IString javaVersion, IEvaluatorContext eval) {
    try {
        CompilationUnit cu = this.getCompilationUnit(loc.getPath(), contents.getValue().toCharArray(), true, javaVersion);

        TypeStore store = new TypeStore();
        store.extendStore(eval.getHeap().getModule("lang::java::m3::Core").getStore());
        store.extendStore(eval.getHeap().getModule("lang::java::m3::AST").getStore());
        SourceConverter converter = new SourceConverter(store);

        converter.set(cu);
        converter.set(loc);
        cu.accept(converter);
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.