Package org.eclipse.imp.pdb.facts

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


        }

        w.put(key, val);
      }

      result = w.done();
    }
    catch (UnsupportedOperationException e) {
      // some maps don't support the full map interface, so we default to normal objects
      String name = o.getClass().getCanonicalName();
      Map<String,IValue> fields = getFields(o, o.getClass(), includes, cache, stack);
View Full Code Here


      throw new FactParseError("premature EOF encountered.",
          reader.getPosition());
    }
    if (reader.getLastChar() == '}') {
      reader.readSkippingWS();
      return w.done();
    }
    ITuple term = parseEntry(reader, expected);
    w.put(term.get(0), term.get(1));
    while (reader.getLastChar() == ',') {
      reader.readSkippingWS();
View Full Code Here

    if (reader.getLastChar() != '}') {
      throw new FactParseError("expected '}' but got '"
          + (char) reader.getLastChar() + "'", reader.getPosition());
    }
    reader.readSkippingWS();
    return w.done();
  }

  private IValue parseString(JSonStream reader, Type expected)
      throws IOException {
    IValue result;
View Full Code Here

    }
    IMapWriter w = vf.mapWriter();
    for (int i = 0; i < t.size(); i++) {
      w.put(a1[i], a2[i]);
    }
    return w.done();
  }

  private IValue[] toArray(IList a) {
    IValue[] r = new IValue[a.length()];
    for (int i = 0; i < r.length; i++)
View Full Code Here

          IValue[] g = toArray(v);
          IMapWriter w = vf.mapWriter();
          for (int j = 0; j < g.length; j++) {
            w.put(((IList) g[j]).get(0), ((IList) g[j]).get(1));
          }
          b[i] = w.done();
        } else if (found.getFieldType(i).isList())
          b[i] = computed[i];
        else
          break;
      } else if (computed[i].getType().isString()) {
View Full Code Here

    if (funname.equals("#map")) {
      IMapWriter w = vf.mapWriter();
      for (int i = 0; i < a.length; i++) {
        w.put(((ITuple) a[i]).get(0), ((ITuple) a[i]).get(1));
      }
      return w.done();
    }
    if (funname.equals("#datetime"))
      return dateTime(((IString) a[0]).getValue());

    Type computed = tf.tupleType(b);
View Full Code Here

      //Type tt = expected.getElementType();
      IMapWriter w = vf.mapWriter(expected); //tt.getFieldType(0), tt.getFieldType(1));
      for (int i = terms.length - 1; i >= 0; i--) {
        w.put(((ITuple) terms[i]).get(0), ((ITuple)terms[i]).get(1));
      }
      return w.done();
    }
    throw new FactParseError("Unexpected type " + expected,
        reader.getPosition());
  }
View Full Code Here

    if(keyArgValues != null) {
      for(Entry<String, IValue> entry : keyArgValues.entrySet()) {
        kwargs.put(rvm.vf.string(entry.getKey()), keyArgValues.get(entry.getValue()));
      }
    }
    args[i] = kwargs.done();
    IValue rval = rvm.executeFunction(this, args);
    return ResultFactory.makeResult(rval.getType(), rval, rvm.getEvaluatorContext())// TODO: remove CTX
  }

  @Override
View Full Code Here

      stack.push(pair.get(1));
      IValue v = read(valueType(type));
      stack.pop();
      w.put(k, v);
    }
    return w.done();
  }

  @Override
  public IValue visitNumber(Type type) throws IOException {
    IValue value = null;
View Full Code Here

          newEntries.put(ent.getKey().accept(this), ent.getValue().accept(this));
        }

        IMapWriter writer = vf.mapWriter(calcLub(newEntries.keySet()), calcLub(newEntries.values()));
        writer.putAll(newEntries);
        return writer.done();
      }

      @Override
      public IValue visitConstructor(IConstructor o)
          throws RuntimeException {
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.