Package org.eclipse.imp.pdb.facts

Examples of org.eclipse.imp.pdb.facts.IMapWriter.done()


      }
      IMapWriter w = vf.mapWriter();
      for (Object k: map.keySet()) {
        w.put(vf.string((String) k), convertToIValue(map.get(k)))
      }
      return vf.constructor(JSON_object, w.done());
    }
    if (obj instanceof List) {
      IListWriter w = vf.listWriter();
      for (Object k: (List)obj) {
        w.append(convertToIValue(k))
View Full Code Here


    if (obj instanceof List) {
      IListWriter w = vf.listWriter();
      for (Object k: (List)obj) {
        w.append(convertToIValue(k))
      }
      return vf.constructor(JSON_array, w.done());
    }
    if (obj instanceof Double) {
      return vf.constructor(JSON_null);
     
    }
View Full Code Here

    IMapWriter mw = values.mapWriter(strType, types.relType(strType, strType));

    for (Map.Entry<java.lang.String, ISetWriter> entry : table.entrySet()) {
      mw.insert(values.tuple(values.string(entry.getKey()), entry.getValue().done()));
    }
    return mw.done();
  }
 
  /*
   * Convert a string element from an RSF tuple to a typed Rascal value
   */
 
View Full Code Here

    for (Map.Entry<java.lang.String, Type> entry : table.entrySet()) {
      Type t = entry.getValue();
      mr.put(values.string(entry.getKey()),
             ((IConstructor) new TypeReifier(values).typeToValue(types.relType(t.getFieldType(0), t.getFieldType(1)), ctx).getValue()))
    }
    return mr.done();
  }
 
  private Type getElementType(String elem){

    if(elem.isEmpty()){
View Full Code Here

        for (IValue key : value) {
          w.put(key, repl.getValue());
        }

        return makeResult(type, w.done(), ctx);
      }
    }
   
    throw new UndeclaredFieldException(type, name);
  }
View Full Code Here

   
    IMapWriter defs = vf.mapWriter();
    for (Map.Entry<IConstructor, IConstructor> entry : definitions.entrySet()) {
      defs.put(entry.getKey(), entry.getValue());
    }
    IValue result = vf.constructor(Factory.Type_Reified.instantiate(bindings), symbol, defs.done());
   
    return ResultFactory.makeResult(typeType, result, ctx);
  }
 
  public Type valueToType(IConstructor typeValue) {
View Full Code Here

       
        for (String key : type.getKeywordParameters()) {
          kwTypes.insert(vf.constructor(Factory.Symbol_Label, vf.string(key), type.getKeywordParameterType(key).accept(this)));
        }
       
        alts.insert(vf.constructor(Factory.Production_Cons, vf.constructor(Factory.Symbol_Label,  vf.string(type.getName()), adt), w.done(), kwTypes.done(), kwDefaults.done(), vf.set()));
        choice = vf.constructor(Factory.Production_Choice, adt, alts.done());
        definitions.put(adt, choice);
      }
     
     
View Full Code Here

        hasMatched |= tr.matched;
        w.put(newKey, newValue);
      }
      tr.changed = hasChanged;
      tr.matched = hasMatched;
      return w.done();
    } else {
      return subject;
    }
  }
View Full Code Here

   
    IMapWriter w = values.mapWriter();
    for(IValueWrap v : hm.keySet()){
      w.put(v.getValue(), hm.get(v).done());
    }
    return w.done();
  }
 
  public IValue toMapUnique(IList lst)
  //@doc{toMapUnique -- convert a list of tuples to a map; result should be a map}
  {
View Full Code Here

       if(seenKeys.contains(key))
        throw RuntimeExceptionFactory.MultipleKey(key.getValue(), null, null);
       seenKeys.add(key);
       w.put(key.getValue(), t.get(1));
     }
     return w.done();
  }

  public IValue toSet(IList lst)
  //@doc{toSet -- convert a list to a set}
  {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.