Package org.eclipse.imp.pdb.facts

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


    }
    return 0;
  }
 
  public int getLength() {
    ISourceLocation loc = getLocation();
    if (loc != null) {
      return loc.getLength();
    }
    return 0;
  }
View Full Code Here


      if (hasJavaModifier(this)) {
        throw new NonAbstractJavaFunction(this);
      }

      ISourceLocation src = this.getLocation();
      AbstractAST ret = ASTBuilder.makeStat("Return", src, ASTBuilder.makeStat("Expression", src, getExpression()));
      AbstractAST fail = ASTBuilder.makeStat("Fail", src, ASTBuilder.make("Target", "Labeled", src, getSignature().getName()));
      AbstractAST ite = ASTBuilder.makeStat("IfThenElse", src, ASTBuilder.make("Label", "Empty", src), getConditions(), ret, fail);
      List<AbstractAST> sl = Arrays.<AbstractAST>asList(ite);
      AbstractAST body = ASTBuilder.make("FunctionBody", "Default", src, sl);
View Full Code Here

    this.production = TreeAdapter.getProduction(node);
    this.type = RascalTypeFactory.getInstance().nonTerminalType(production);
    this.args = args;
    this.constant = false; // TODO! isConstant(args);
    this.node = this.constant ? node : null;
    ISourceLocation src = TreeAdapter.getLocation(node);
   
    if (src != null) {
      this.setSourceLocation(src);
    }
  }
View Full Code Here

    IListWriter w = eval.getValueFactory().listWriter(Factory.Tree);
    for (org.rascalmpl.ast.Expression arg : args) {
      w.append(arg.interpret(eval).getValue());
    }
   
    ISourceLocation location = getLocation();
   
    if (location != null) {
      java.util.Map<String,IValue> annos = new HashMap<String,IValue>();
      annos.put("loc", location);
      return makeResult(type, eval.getValueFactory().constructor(Factory.Tree_Appl, annos, production, w.done()), eval);
View Full Code Here

  public Void visitSourceLocation(ISourceLocation value) throws IOException {
    // {loc: {...} }
    out.beginArray();
    out.value("loc");
    out.beginObject();
    ISourceLocation loc = (ISourceLocation) value;

    out.name("scheme");
    out.value(loc.getScheme());

    if (loc.hasAuthority()) {
      out.name("authority");
      out.value(loc.getAuthority());
    }
    if (loc.hasPath()) {
      out.name("path");
      out.value(loc.getPath());
    }
    if (loc.hasFragment()) {
      out.name("fragment");
      out.value(loc.getFragment());
    }
    if (loc.hasQuery()) {
      out.name("query");
      out.value(loc.getQuery());
    }

    if (loc.hasOffsetLength()) {
      out.name("offset");
      out.value(loc.getOffset());
      out.name("length");
      out.value(loc.getLength());
    }

    if (loc.hasLineColumn()) {
      out.name("beginLine");
      out.value(loc.getBeginLine());
      out.name("endLine");
      out.value(loc.getEndLine());
      out.name("beginColumn");
      out.value(loc.getBeginColumn());
      out.name("endColumn");
      out.value(loc.getEndColumn());
    }

    out.endObject();
    out.endArray();
    return null;
View Full Code Here

    IListWriter w = eval.getValueFactory().listWriter(Factory.Tree);
    for (org.rascalmpl.ast.Expression arg : args) {
      w.append(arg.interpret(eval).getValue());
    }
   
    ISourceLocation location = getLocation();
   
    if (location != null) {
      java.util.Map<String,IValue> annos = new HashMap<String,IValue>();
      annos.put("loc", location);
      return makeResult(type, eval.getValueFactory().constructor(Factory.Tree_Appl, annos, production, flatten(w.done())), eval);
View Full Code Here

        Throw th = (Throw) targetException;
       
        StackTrace trace = new StackTrace();
        trace.addAll(th.getTrace());
       
        ISourceLocation loc = th.getLocation();
        if (loc == null) {
          loc = getAst().getLocation();
        }
        trace.add(loc, null);
View Full Code Here

      String uri = ((IString) protocolPart.getValue()).getValue() + "://"
          + ((IString) pathPart.getValue()).getValue();

      try {
        URI url = URIUtil.createFromEncoded(uri);
        ISourceLocation r = __eval.__getVf().sourceLocation(url);
        return org.rascalmpl.interpreter.result.ResultFactory
            .makeResult(org.rascalmpl.interpreter.Evaluator
                .__getTf().sourceLocationType(), r, __eval);
      } catch (URISyntaxException e) {
        throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
View Full Code Here

 
  public void doImport(IRascalMonitor monitor, String string) {
    IRascalMonitor old = setMonitor(monitor);
    interrupt = false;
    try {
      ISourceLocation uri = vf.sourceLocation(URIUtil.rootScheme("import"));
      org.rascalmpl.semantics.dynamic.Import.importModule(string, uri, this);
    }
    finally {
      setMonitor(old);
      setCurrentAST(null);
View Full Code Here

  private void reloadModule(String name, URI errorLocation) { 
    ModuleEnvironment env = new ModuleEnvironment(name, getHeap());
    heap.addModule(env);

    try {
      ISourceLocation loc = getValueFactory().sourceLocation(errorLocation);
      org.rascalmpl.semantics.dynamic.Import.loadModule(loc, name, this);
    } catch (StaticError e) {
      heap.removeModule(env);
      throw e;
    } catch (Throw e) {
View Full Code Here

TOP

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

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.