Package org.eclipse.imp.pdb.facts

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


      content.append(resultMessage(result));
    }
    catch (ParseError pe) {
      content.append(parseErrorMessage(command.getValue(), "stdin", pe));
      content.append('\n');
      ISourceLocation sourceLocation = values.sourceLocation(values.sourceLocation(pe.getLocation()), pe.getOffset(), pe.getLength(), pe.getBeginLine(), pe.getEndLine(), pe.getBeginColumn(), pe.getEndColumn());
      throw new Throw(values.constructor(ShellParseError, values.string(content.toString()), sourceLocation), ctx.getCurrentAST(), ctx.getStackTrace());
    }
    catch (QuitException q){
      //
    }
View Full Code Here


    return false;
  }
 
  private void addTypeDependency(ISourceLocation dependency) {
    if (!scopeManager.isEmpty()) {
      ISourceLocation parent = getParent();
      if (!parent.isEqual(dependency)) {
        insert(typeDependency, parent, dependency);
      }
    }
  }
View Full Code Here

  public boolean visit(AnonymousClassDeclaration node) {
    insert(containment, getParent(), ownValue);
    // enum constant declaration and classinstancecreation gives types for anonymousclasses
    ASTNode parent = node.getParent();
    if (parent instanceof ClassInstanceCreation) {
      ISourceLocation superclass = resolveBinding(((ClassInstanceCreation) parent).getType());
      insert(typeDependency, ownValue, superclass);
      IConstructor type = bindingsResolver.resolveType(((ClassInstanceCreation) parent).getType().resolveBinding(), false);
        insert(types, ownValue, type);
       
        if (!superclass.getScheme().contains("+interface")) {
          insert(extendsRelations, ownValue, superclass);
        }
        else {
          insert(implementsRelations, ownValue, superclass);
        }
View Full Code Here

   
 
    @Override
    public Result<IValue> interpret(IEvaluator<Result<IValue>> eval) {
      // Compute the URI location, which contains the scheme (and other info we need later)
      ISourceLocation sl = (ISourceLocation)getAt().interpret(eval).getValue();
     
      // If we have a resource scheme, given as resource scheme + standard scheme, we
      // extract that out, e.g., jdbctable+mysql would give a resource scheme of
      // jdbctable and a standard URI scheme of mysql. If we do not have a separate
      // resource scheme, we just use the specified scheme, e.g., sdf would give
      // a resource scheme of sdf and a URI scheme of sdf.
      URI uri = sl.getURI();
      String resourceScheme = uri.getScheme();
     
      if (resourceScheme.contains("+")) {
        String uriScheme = resourceScheme.substring(resourceScheme.indexOf("+")+1);
        resourceScheme = resourceScheme.substring(0,resourceScheme.indexOf("+"));
View Full Code Here

          Map<String, String> files) {
        IConstructor methodVal = makeMethod(method);
        IMap headersVal = makeMap(headers);
        IMap paramsVal= makeMap(parms);
        IMap filesVal= makeMap(files);
        ISourceLocation loc = vf.sourceLocation(URIUtil.assumeCorrect("request", "", uri));
        try {
          synchronized (callee.getEval()) {
            callee.getEval().__setInterrupt(false);
            Result<IValue> response = callee.call(argTypes, new IValue[] { loc, methodVal, headersVal, paramsVal, filesVal }, null);
            return translateResponse(method, response.getValue())
          }
        }
        catch (Throw rascalException) {
          ctx.getStdErr().println(rascalException.getMessage());
          return new Response(Status.INTERNAL_ERROR, "text/plain", rascalException.getMessage());
        }
        catch (Throwable unexpected) {
          ctx.getStdErr().println(unexpected.getMessage());
          unexpected.printStackTrace(ctx.getStdErr());
          return new Response(Status.INTERNAL_ERROR, "text/plain", unexpected.getMessage());
        }
      }

      private Response translateResponse(Method method, IValue value) {
        IConstructor cons = (IConstructor) value;
        initMethodAndStatusValues(ctx);
       
        if (cons.getName().equals("fileResponse")) {
          return translateFileResponse(method, cons);
        }
        else {
          return translateTextResponse(method, cons);
        }
      }
     
      private Response translateFileResponse(Method method, IConstructor cons) {
        ISourceLocation l = (ISourceLocation) cons.get("file");
        IString mimeType = (IString) cons.get("mimeType");
        IMap header = (IMap) cons.get("header");
        URI uri = l.getURI();
       
        Response response;
        try {
          response = new Response(Status.OK, mimeType.getValue(), ctx.getResolverRegistry().getInputStream(uri));
          addHeaders(response, header);
View Full Code Here

        String nested = "";
        URI uri = URIUtil.assumeCorrect("tmp:///");
       
        if (stRandom.nextDouble() > 0.5) {
          RandomValueTypeVisitor visitor = descend();
          ISourceLocation loc = (ISourceLocation) visitor.generate(type);
          uri = loc.getURI();
          nested = uri.getPath();
        }
       
        path = path.startsWith("/") ? path : "/" + path;
        uri = URIUtil.changePath(uri, nested.length() > 0 && !nested.equals("/") ? nested + path : path);
View Full Code Here

  public void set(ISourceLocation loc) {
    this.loc = loc;
  }
 
  protected ISourceLocation resolveBinding(String packageComponent) {
    ISourceLocation packageBinding = new BindingsResolver(typeStore, this.collectBindings) {
      public ISourceLocation resolveBinding(String packageC) {
        try {
          if (collectBindings) {
            if (EclipseJavaCompiler.cache.containsKey(packageC)) {
              return EclipseJavaCompiler.cache.get(packageC);
View Full Code Here

    EclipseJavaCompiler.cache.put(packageComponent, packageBinding);
    return packageBinding;
  }
 
  protected ISourceLocation resolveBinding(CompilationUnit node) {
    ISourceLocation compilationUnit = new BindingsResolver(typeStore, true) {
      public ISourceLocation resolveBinding(CompilationUnit node) {
        return makeBinding("java+compilationUnit", null, loc.getPath());
      }
    }.resolveBinding(node);
   
View Full Code Here

   
    return compilationUnit;
  }
 
  protected ISourceLocation resolveBinding(IBinding binding) {
    ISourceLocation resolvedBinding = bindingsResolver.resolveBinding(binding);
    if (binding != null)
      EclipseJavaCompiler.cache.put(binding.getKey(), resolvedBinding);
    return resolvedBinding;
  }
View Full Code Here

      EclipseJavaCompiler.cache.put(binding.getKey(), resolvedBinding);
    return resolvedBinding;
  }
 
  protected ISourceLocation resolveDeclaringClass(IBinding binding) {
    ISourceLocation resolvedBinding;
    if (binding instanceof ITypeBinding) {
      resolvedBinding = bindingsResolver.resolveBinding(((ITypeBinding) binding).getDeclaringClass());
    } else if (binding instanceof IMethodBinding) {
      resolvedBinding = bindingsResolver.resolveBinding(((IMethodBinding) binding).getDeclaringClass());
    } else if (binding instanceof IVariableBinding) {
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.