Package org.eclipse.imp.pdb.facts

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


          endIndex = -1;
      }

      if (rec.getType().isList()) {
        try {
          IList list = (IList) rec.getValue();         
         
          IValue repl = __eval.__getValue().getValue();
          if(!repl.getType().isList()){
            throw new UnexpectedType(rec.getType(), repl.getType(), __eval.__getEval().getCurrentAST());
          }
         
          __eval.__setValue(__eval.newResult(list, __eval.__getValue()));         
          list = list.replace(firstIndex, secondIndex, endIndex, (IList) repl);
         
          result = org.rascalmpl.interpreter.result.ResultFactory
              .makeResult(rec.hasInferredType() ? rec.getType()
                  .lub(list.getType()) : rec.getType(), list,
                  __eval.__getEval());
        } catch (IndexOutOfBoundsException e) { // include last in message
          throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
          .indexOutOfBounds((IInteger) first.getValue(),
              __eval.__getEval().getCurrentAST(), __eval
View Full Code Here


    int i = 0;
   
    for (IValue prod : robust) {
      robustProds[i] = (IConstructor) prod;
      List<Integer> chars = new LinkedList<Integer>();
      IList ranges = (IList) robust.get(prod);
     
      for (IValue range : ranges) {
        int from = ((IInteger) ((IConstructor) range).get("begin")).intValue();
        int to = ((IInteger) ((IConstructor) range).get("end")).intValue();
       
View Full Code Here

  }
 
  @Override
  public Result<IValue> call(Type[] actualTypes, IValue[] actuals, Map<String, IValue> keyArgValues) {
    IConstructor prod = (IConstructor) actuals[0];
    IList args = (IList) actuals[1];

    if (ProductionAdapter.isList(prod)) {
      actuals[1] = flatten(prod, args);
    }
View Full Code Here

   
    for (int i = 0; i < args.length(); i+=(delta + 1)) {
      IConstructor tree = (IConstructor) args.get(i);
      if (TreeAdapter.isList(tree) && TreeAdapter.isAppl(tree)) {
        if (ProductionAdapter.shouldFlatten(prod, TreeAdapter.getProduction(tree))) {
          IList nestedArgs = TreeAdapter.getArgs(tree);
          if (nestedArgs.length() > 0) {
            appendSeparators(args, result, delta, i);
            result.appendAll(nestedArgs);
          }
          else {
            // skip following separators
View Full Code Here

    if (!prod.isEqual(production)) {
      hasNext = false;
      return;
    }
   
    IList args = TreeAdapter.getArgs(tree);
   
    switch (type) {
    case MayExist:
      optArg.initMatch(subject);
      hasNext = optArg.hasNext();
      return;
    case Exist:
      if (args.length() == 1) {
        IConstructor arg = (IConstructor) args.get(0);
        Type argType = RascalTypeFactory.getInstance().nonTerminalType(arg);
        Result<IValue> argResult = ResultFactory.makeResult(argType, arg, ctx);
        optArg.initMatch(argResult);
        hasNext = optArg.hasNext();
        return;
      }
     
      hasNext = false;
      return;
    case NotExist:
      hasNext = args.length() == 0;
      return;
    }
   
  }
View Full Code Here

    if (!ProductionAdapter.isDefault(prod)) {
      return -1;
    }
   
    IList syms = ProductionAdapter.getSymbols(prod);

    for (int i = 0; i < syms.length(); i++) {
      IConstructor sym = (IConstructor) syms.get(i);

      while (SymbolAdapter.isConditional(sym)) {
        sym = SymbolAdapter.getSymbol(sym);
      }
View Full Code Here

  public static IList getListASTArgs(IConstructor tree) {
    if (!isList(tree)) {
      throw new ImplementationError(
          "This is not a context-free list production: " + tree);
    }
    IList children = getArgs(tree);
    IListWriter writer = ValueFactoryFactory.getValueFactory().listWriter(Factory.Args.getElementType());

    for (int i = 0; i < children.length(); ++i) {
      IValue kid = children.get(i);
      writer.append(kid);
      // skip layout and/or separators
      if (isSeparatedList(tree)) {
        i += getSeparatorCount(tree);
      } else {
View Full Code Here

   
    if (isLexical(tree)) {
      throw new ImplementationError("This is not a context-free production: " + tree);
    }

    IList children = getArgs(tree);
    IListWriter writer = ValueFactoryFactory.getValueFactory().listWriter(Factory.Args.getElementType());

    for (int i = 0; i < children.length(); i++) {
      IConstructor kid = (IConstructor) children.get(i);
      if (!isLiteral(kid) && !isCILiteral(kid)) {
        writer.append(kid);
      }
      // skip layout
      i++;
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

     
      return null;
    }

    if (TreeAdapter.isAppl(tree) && !TreeAdapter.isLexical(tree)) {
      IList children = TreeAdapter.getArgs(tree); //TreeAdapter.getASTArgs(tree);

      for (IValue child : children) {
        ISourceLocation childLoc = TreeAdapter
            .getLocation((IConstructor) child);
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.