Package org.eclipse.imp.pdb.facts

Examples of org.eclipse.imp.pdb.facts.IValueFactory.string()


      IConstructor prod = TreeAdapter.getProduction(tree);
      IConstructor sym = ProductionAdapter.getDefined(prod);
      sym = SymbolAdapter.delabel(sym);
      IValueFactory vf = eval.getValueFactory();
      prod = ProductionAdapter.setDefined(prod, vf.constructor(Factory.Symbol_Label, vf.string("$parsed"), sym));
      return TreeAdapter.setProduction(TreeAdapter.setArg(tree, "parts", fragment), prod);
    }
    catch (ParseError e) {
      ISourceLocation loc = TreeAdapter.getLocation(tree);
      ISourceLocation src = eval.getValueFactory().sourceLocation(loc.getURI(), loc.getOffset() + e.getOffset(), loc.getLength(), loc.getBeginLine() + e.getBeginLine() - 1, loc.getEndLine() + e.getEndLine() - 1, loc.getBeginColumn() + e.getBeginColumn(), loc.getBeginColumn() + e.getEndColumn());
View Full Code Here


      Sym type = getDefined();
      IValueFactory vf = eval.getValueFactory();
     
      if (type.isNonterminal()) {
        String nt = ((Nonterminal.Lexical) type.getNonterminal()).getString();
        eval.getCurrentEnvt().concreteSyntaxType(nt, vf.constructor(Factory.Symbol_Sort, vf.string(nt)));
      }
     
      eval.getCurrentModuleEnvironment().declareProduction(getTree());
      return null;
    }
View Full Code Here

      Sym type = getDefined();
      IValueFactory vf = eval.getValueFactory();
     
      if (type.isNonterminal()) {
        String nt = ((Nonterminal.Lexical) type.getNonterminal()).getString();
        eval.getCurrentEnvt().concreteSyntaxType(nt, vf.constructor(Factory.Symbol_Sort, vf.string(nt)));
      }
     
      eval.getCurrentModuleEnvironment().declareProduction(getTree());
      return null;
    }
View Full Code Here

      Sym type = getDefined();
      IValueFactory vf = eval.getValueFactory();
     
      if (type.isNonterminal()) {
        String nt = ((Nonterminal.Lexical) type.getNonterminal()).getString();
        eval.getCurrentEnvt().concreteSyntaxType(nt, vf.constructor(Factory.Symbol_Sort, vf.string(nt)));
      }
     
      eval.getCurrentModuleEnvironment().declareProduction(getTree());
      return null;
    }
View Full Code Here

      Sym type = getDefined();
      IValueFactory vf = eval.getValueFactory();
     
      if (type.isNonterminal()) {
        String nt = ((Nonterminal.Lexical) type.getNonterminal()).getString();
        eval.getCurrentEnvt().concreteSyntaxType(nt, vf.constructor(Factory.Symbol_Keyword, vf.string(nt)));
      }
     
      eval.getCurrentModuleEnvironment().declareProduction(getTree());
      return null;
    }
View Full Code Here

          // the root path should end with a / (c:/ not c:)
          if (path.lastIndexOf((int)'/') == 0 && path.endsWith(":")) {
            path += "/";
          }
        }
        return fieldUpdate("path", makeResult(tf.stringType(), vf.string(path), ctx), store);
      }
      throw RuntimeExceptionFactory.noParent(getValue(), ctx.getCurrentAST(), ctx.getStackTrace());
    }

    case "file": {
View Full Code Here

    case "ls": {
      try {
        ISourceLocation resolved = ctx.getHeap().resolveSourceLocation(value);
        if (!ctx.getResolverRegistry().isDirectory(resolved.getURI())) {
          throw RuntimeExceptionFactory.io(vf.string("You can only access ls on a directory, or a container."), ctx.getCurrentAST(), ctx.getStackTrace());
        }
        Result<IValue> resRes = makeResult(getType(), resolved, ctx);

        IListWriter w = ctx.getValueFactory().listWriter();
        Type stringType = tf.stringType();
View Full Code Here

        IListWriter w = ctx.getValueFactory().listWriter();
        Type stringType = tf.stringType();

        for (String elem : ctx.getResolverRegistry().listEntries(resolved.getURI())) {
          w.append(resRes.add(makeResult(stringType, vf.string(elem), ctx)).getValue());
        }

        IList result = w.done();
        // a list of loc's
        return makeResult(result.getType(), result, ctx);
View Full Code Here

        IList result = w.done();
        // a list of loc's
        return makeResult(result.getType(), result, ctx);
       
      } catch (IOException e) {
        throw RuntimeExceptionFactory.io(vf.string(e.getMessage()), ctx.getCurrentAST(), ctx.getStackTrace());
      }
     
    }

    case "extension" : {
View Full Code Here

     
      if (query != null && query.length() > 0) {
        String[] params = query.split("&");
        for (String param : params) {
          String[] keyValue = param.split("=");
          res.put(vf.string(keyValue[0]), vf.string(keyValue[1]));
        }
      }
     
      IMap map = res.done();
      return makeResult(map.getType(), map, ctx);
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.