Examples of createAST()


Examples of en.JS2AST.createAST()

   
    JS2AST jp = new JS2AST();
    //System.out.print(p.createAST(codeURL));
    //Document d = jp.createAST(in,"test/toto.js");
   
    Document d = jp.createAST(in,new URL("http://www.savills.co.uk/_js/common.js"));
   
    //Utils.printXML(d);   
    Program p = ASTBuilder.buildFromXML(d)
    System.out.print(p);
   
View Full Code Here

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

    this.source = removeIndentAndNewLines(this.source, document, cu);
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(this.source.toCharArray());
    parser.setProject(getCompilationUnit().getJavaProject());
    parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
    ASTNode node = parser.createAST(this.progressMonitor);
    String createdNodeSource;
    if (node.getNodeType() != ASTNode.TYPE_DECLARATION) {
      createdNodeSource = generateSyntaxIncorrectAST();
      if (this.createdNode == null)
        throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
View Full Code Here

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

  buff.append(lineSeparator + " public class A {" + lineSeparator); //$NON-NLS-1$
  buff.append(this.source);
  buff.append(lineSeparator).append('}');
  ASTParser parser = ASTParser.newParser(AST.JLS3);
  parser.setSource(buff.toString().toCharArray());
  CompilationUnit compilationUnit = (CompilationUnit) parser.createAST(null);
  TypeDeclaration typeDeclaration = (TypeDeclaration) compilationUnit.types().iterator().next();
  List bodyDeclarations = typeDeclaration.bodyDeclarations();
  if (bodyDeclarations.size() != 0)
    this.createdNode = (ASTNode) bodyDeclarations.iterator().next();
  return buff.toString();
View Full Code Here

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

    if (JavaProject.hasJavaNature(workingCopy.getJavaProject().getProject()))
      parser.setResolveBindings(true);
    parser.setStatementsRecovery((this.operation.reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
    parser.setBindingsRecovery((this.operation.reconcileFlags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0);
    parser.setSource(workingCopy);
    return (org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(this.operation.progressMonitor);   
  }
  return this.operation.makeConsistent(this.workingCopy);
}

/**
 
View Full Code Here

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

    ASTParser parser = ASTParser.newParser(this.apiLevel);
    parser.setCompilerOptions(options.getMap());
    parser.setSource(source);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setResolveBindings(false);
    org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit ast = (org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(null);
       
    ASTRewrite rewriter= sortCompilationUnit(ast, null);
    if (rewriter == null)
      return document.get();
   
View Full Code Here

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

    // ensure cu is consistent (noop if already consistent)
    cu.makeConsistent(this.progressMonitor);
    // create an AST for the compilation unit
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(cu);
    return (CompilationUnit) parser.createAST(this.progressMonitor);
  }
  /**
   * Sets the name of the <code>DOMNode</code> that will be used to
   * create this new element.
   * Used by the <code>CopyElementsOperation</code> for renaming.
View Full Code Here

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

        catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        parser.setSource(writer.toString().toCharArray());
        ASTNode ast = parser.createAST(new NullProgressMonitor());
        ast.accept(new ASTVisitor() {

            private Map<String, String> _imports = new HashMap<String, String>();
           
            @Override
View Full Code Here

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

            WGUtils.inToOut(reader, writer, 1024);
        }
        catch (IOException e) {
        }
        parser.setSource(writer.toString().toCharArray());
        ASTNode ast = parser.createAST(new NullProgressMonitor());
        ast.accept(new ASTVisitor() {
            private Map<String, String> _imports = new HashMap<String, String>();

            @Override
            public void endVisit(ImportDeclaration node) {
View Full Code Here

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

        catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        parser.setSource(writer.toString().toCharArray());
        ASTNode ast = parser.createAST(new NullProgressMonitor());
        ast.accept(new ASTVisitor() {
           
            private Map<String, String> _imports = new HashMap<String, String>();

            @Override
View Full Code Here

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

    IPackageFragment pack = (IPackageFragment) cu.getParent();
    String content = CodeGeneration.getCompilationUnitContent(cu, typeComment, typeContent, lineDelimiter);
    if (content != null) {
      ASTParser parser = ASTParser.newParser(AST.JLS2);
      parser.setSource(content.toCharArray());
      CompilationUnit unit = (CompilationUnit) parser.createAST(null);
      if ((pack.isDefaultPackage() || unit.getPackage() != null) && !unit.types().isEmpty()) { return content; }
    }
    StringBuffer buf = new StringBuffer();
    if (!pack.isDefaultPackage()) {
      buf.append("package ").append(pack.getElementName()).append(';'); //$NON-NLS-1$
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.