Package org.eclipse.imp.pdb.facts

Examples of org.eclipse.imp.pdb.facts.IList


    if (isAppl(tree)) {
      String s = ProductionAdapter.getCategory(getProduction(tree));
      if (s == category)
        writer.append(tree);
      else {
        IList z = getArgs(tree);
        for (IValue q : z) {
          if (!(q instanceof IConstructor))
            continue;
          IList p = searchCategory((IConstructor) q, category);
          writer.appendAll(p);
        }
      }
    }
    return writer.done();
View Full Code Here


    if (TreeAdapter.isAmb(tree)) {
      return null;
    }
 
    if (TreeAdapter.isAppl(tree)) {
      IList children = TreeAdapter.getASTArgs(tree);
 
      for (IValue child : children) {
        ISourceLocation childLoc = TreeAdapter
            .getLocation((IConstructor) child);
 
View Full Code Here

  }

  @Override
  protected <U extends IValue> Result<U> subtractList(ListResult l) {
    // Note the reversal of args
    IList list = l.getValue();
    for (IValue v: getValue()) {
      if (list.contains(v)) {
        list = list.delete(v);
      }
    }
    return makeResult(l.getType(), list, ctx);
  }
View Full Code Here

    Type newType = getTypeFactory().listType(that.getType().lub(getType().getElementType()));
    return makeResult(newType, value.append(that.getValue()), ctx);
  }

  protected <U extends IValue, V extends IValue> Result<U> removeElement(ElementResult<V> value) {
    IList list = getValue();
    return makeResult(getType(), list.delete(value.getValue()), ctx);
  }
View Full Code Here

    return that.lessThanOrEqualList(this);
  }
 
  @Override
  protected Result<IBool> lessThanList(ListResult that) {
    IList val = that.getValue();
   
    if (val.length() > value.length()) {
      return bool(false, ctx);
    }
   
    OUTER:for (int iThat = 0, iThis = 0; iThat < val.length(); iThat++) {
      for (iThis = Math.max(iThis, iThat) ; iThis < value.length(); iThis++) {
        if (val.get(iThat).isEqual(value.get(iThis))) {
          iThis++;
          continue OUTER;
        }
      }
      return bool(false, ctx);
    }

    return bool(val.length() != value.length(), ctx);
  }
View Full Code Here

    return bool(val.length() != value.length(), ctx);
  }
 
  @Override
  protected LessThanOrEqualResult lessThanOrEqualList(ListResult that) {
    IList left = that.getValue();
    IList right = getValue();
   
    if (left.length() == 0) {
      return new LessThanOrEqualResult(right.length() > 0, right.length() == 0, ctx);
    }
    else if (left.length() > right.length()) {
      return new LessThanOrEqualResult(false, false, ctx);
    }
   
    OUTER:for (int iThat = 0, iThis = 0; iThat < left.length(); iThat++) {
      for (iThis = Math.max(iThis, iThat) ; iThis < right.length(); iThis++) {
        if (left.get(iThat).isEqual(right.get(iThis))) {
          continue OUTER;
        }
      }
      return new LessThanOrEqualResult(false, false, ctx);
    }
   
    return new LessThanOrEqualResult(left.length() < right.length(), left.length() == right.length(), ctx);
  }
View Full Code Here

  static IList getEmptyList() {
    return vf.list(box);
  }

  static IList getList(IValue... t) {
    IList q = BoxADT.getEmptyList();
    for (IValue a : t) {
      if (a == null)
        continue;
      if (a.getType().isList()) {
        q = q.concat((IList) a);
      } else
        q = q.append(a);
    }
    return q;
  }
View Full Code Here

  static IConstructor H(IValue... t) {
    return H(-1, t);
  }

  static IConstructor H(int hspace, IValue... t) {
    IList q = BoxADT.getEmptyList();
    for (IValue a : t) {
      if (a == null)
        continue;
      if (a.getType().isList()) {
        q = q.concat((IList) a);
      } else
        q = q.append(a);
    }
    IConstructor r = BoxADT.TAG.H.create(q);
    if (hspace >= 0)
      r = r.asAnnotatable().setAnnotation("hs", vf.integer(hspace));
    return r;
View Full Code Here

  static IConstructor V(int vspace, IValue... t) {
    return V(vspace, false, t);
  }

  static IList makeIndent(IList a, boolean first) {
    IList q = BoxADT.getEmptyList();
    for (IValue b : a) {
      q = q.append(first && q.isEmpty() ? b : I((IConstructor) b));
   
    return q;
  }
View Full Code Here

   
    return q;
  }

  static IConstructor V(int vspace, boolean indent, IValue... t) {
    IList q = BoxADT.getEmptyList();
    for (IValue a : t) {
      if (a == null)
        continue;
      if (a.getType().isList()) {

        q = q.concat(indent ? makeIndent((IList) a, q.isEmpty())
            : (IList) a);
      } else
        q = q.append(indent && !q.isEmpty() ? I(a) : a);
    }
    // int last = q.length()-1;
    // IConstructor c = ((IConstructor) q.get(last));
    // if (c.getConstructorType().getName()=="I") {
    // q=q.put(last, c.get(0));
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.IList

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.