Package org.eclipse.php.internal.core.ast.nodes

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


   
    try {
     
      StringReader stringReader = new StringReader(new String());
      ASTParser previewParser = ASTParser.newParser(stringReader, ProjectOptions.getPhpVersion(fSourceModule), false);
      Program previewProgram = previewParser.createAST(null);
     
      previewProgram.recordModifications();
      AST previewAST = previewProgram.getAST();
     
      FunctionDeclaration function = previewAST.newFunctionDeclaration(previewAST.newIdentifier(fMethodName), computeArguments(previewAST), previewAST.newBlock(), false);
View Full Code Here

    name = buffer.toString();     
         
    ASTParser parser = ASTParser.newParser(source);
    parser.setSource(document.get().toCharArray());
   
    Program program = parser.createAST(new NullProgressMonitor());     
//    program.recordModifications();   
//    AST ast = program.getAST();   

    ISourceRange range = type.getSourceRange();   
    ASTNode node = program.getElementAt(range.getOffset());
View Full Code Here

      if (sourceModule != null) {
        ASTParser parser = ASTParser.newParser(PHPVersion.PHP5_5,
            sourceModule);
        parser.setSource(fDocument.get().toCharArray());

        final Program program = parser.createAST(null);
        List<AbstractSemanticHighlighting> highlightings = new ArrayList<AbstractSemanticHighlighting>();

        highlightings.add(new StaticFieldHighlighting() {
          @Override
          protected Program getProgram(
View Full Code Here

    ISourceModule sourceModule = null;
    sourceModule = DLTKCore.createSourceModuleFrom(testFile);
    ASTParser parser = ASTParser.newParser(
        new InputStreamReader(testFile.getContents()), version, false,
        sourceModule);
    return parser.createAST(new NullProgressMonitor());
  }

  /**
   * Get the ITypeBinding for the marked content in he given string.
   *
 
View Full Code Here

    document = new Document(content);

    ASTParser parser = ASTParser.newParser(phpVersion,
        ProjectOptions.useShortTags((IProject) null));
    parser.setSource(document.get().toCharArray());
    program = parser.createAST(new NullProgressMonitor());
    ast = program.getAST();

    program.recordModifications();
  }
View Full Code Here

   */
  private Program initialize(IDocument document) throws Exception {
    ASTParser parser = ASTParser.newParser(getPHPVersion(),
        ProjectOptions.useShortTags((IProject) null));
    parser.setSource(document.get().toCharArray());
    Program program = parser.createAST(new NullProgressMonitor());

    program.recordModifications();
    return program;
  }

View Full Code Here

                .getAlias() + " - /" + fileName) {

              protected void runTest() throws Throwable {
                newParser.setSource(pdttFile.getFile().trim()
                    .toCharArray());
                Program program = newParser
                    .createAST(new NullProgressMonitor());

                assertContents(pdttFile.getExpected(),
                    program.toString());
              }
View Full Code Here

    } else {
      version = ProjectOptions.getDefaultPhpVersion();
    }
    ASTParser newParser = ASTParser.newParser(version,
        (ISourceModule) source);
    return newParser.createAST(null);
  }

  protected ASTNode locateNode(Program program, int start, int end) {
    ASTNode locateNode = NodeFinder.perform(program, start, end);
    return locateNode;
View Full Code Here

      if (initialReconcile || astProvider.isActive(unit)) {
        PHPVersion phpVersion = ProjectOptions.getPhpVersion(unit
            .getScriptProject().getProject());
        ASTParser newParser = ASTParser.newParser(phpVersion, unit);
        createdAST = newParser.createAST(null);
        if (createdAST != null && document != null) {
          createdAST.setSourceModule(unit);
          createdAST.setSourceRange(0, document.getLength());
          createdAST.setLineEndTable(Util.lineEndTable(document));
        }
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.