Examples of createAST()


Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

      ICompilationUnit icunit = type.getCompilationUnit();
      String source = icunit.getBuffer().getContents();
      Document document = new Document(source);
      ASTParser parser = ASTParser.newParser(AST.JLS3);
      parser.setSource(icunit);
      CompilationUnit cunit = (CompilationUnit) parser.createAST(null);
      cunit.recordModifications();
      AST ast = cunit.getAST();
      TypeDeclaration typeDec = (TypeDeclaration) cunit.types().get(0);
      List list = typeDec.superInterfaceTypes();
      Name name = ast.newName(cName);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setProject(javaProject);
    parser.setSource(code.toCharArray());
    parser.setUnitName("/CrystalTest/" + qualifiedCompUnitName);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);
   
    Message[] msgs = node.getMessages();
    if(msgs.length > 0) {
      StringBuffer errs = new StringBuffer();
      errs.append("Compiler problems for ");
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

     for(; iter.hasNext() ;) {
       compUnit = iter.next();
        parser = ASTParser.newParser(AST.JLS3);
       parser.setResolveBindings(true);
       parser.setSource(compUnit);
       node = parser.createAST(null);
       parsedCompilationUnits.put(compUnit, node);
     }
     return parsedCompilationUnits;
  }
 
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

  public static ASTNode getASTNodeFromCompilationUnit(ITypeRoot compUnit) {
     ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setResolveBindings(true);
    parser.setSource(compUnit);
    try {
      return parser.createAST(/* passing in monitor messes up previous monitor state */ null);
    } catch (IllegalStateException e) {
      log.log(Level.SEVERE, "could not parse " + compUnit, e);
      throw e;
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

     for(; iter.hasNext() ;) {
       compUnit = iter.next();
        parser = ASTParser.newParser(AST.JLS3);
       parser.setResolveBindings(true);
       parser.setSource(compUnit);
       node = parser.createAST(null);
       parsedCompilationUnits.put(compUnit, node);
     }
     return parsedCompilationUnits;
  }
 
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

   */
  public static ASTNode getASTNodeFromCompilationUnit(ICompilationUnit compUnit) {
     ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setResolveBindings(true);
    parser.setSource(compUnit);
    return parser.createAST(/* passing in monitor messes up previous monitor state */ null);
  }

  /**
   * Given an IType from the model, this method will return the ast node
   * associated with that type, or null if it doesn't exist.
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setProject(javaProject);
    parser.setSource(code.toCharArray());
    parser.setUnitName("/CrystalTest/" + qualifiedCompUnitName);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);
   
    Message[] msgs = node.getMessages();
    if(msgs.length > 0) {
      StringBuffer errs = new StringBuffer();
      errs.append("Compiler problems for ");
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

        .getCompilationUnit();

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setSource(source);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);

    return node;
  }

  static public boolean testAndCompareCFG(MethodDeclaration method)
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()

    parser.setResolveBindings(true);
    // parser.setBindingsRecovery(true);
    parser.setSource(code.toCharArray());
    parser.setUnitName("Foo.java");
    // parser.setProject(JavaCore.create(null));
    node = (CompilationUnit) parser.createAST(null);

    for (IProblem problem : node.getProblems()) {
      System.out.println("Compile problem for " + subFolder + "_" + file);
      System.out.println(problem.getMessage());
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.ast.nodes.ASTParser.createAST()

    }
   
    try {
      // parse the php code and create a program
      ASTParser parser = ASTParser.newParser(fSourceModule);
      fProgram = parser.createAST(null);
    } catch(Exception e) {
      throw new RefactoringStatusException(RefactoringMessages.ExtractMethodInputPage_errorCouldNotParseSourceCode);
    }
   
    // Get covering namespace/class/method/function declaration
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.