Package org.aspectj.org.eclipse.jdt.internal.compiler

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.SourceElementParser


}
/**
* Creates a new parser.
*/
protected SourceElementParser getParser(Map settings) {
  return new SourceElementParser(this, new DefaultProblemFactory(), new CompilerOptions(settings), false/*don't report local declarations*/, true/*optimize string literals*/);
}
 
View Full Code Here


  Map options = project == null ? JavaCore.getOptions() : project.getOptions(true);
  if (!computeProblems) {
    // disable task tags checking to speed up parsing
    options.put(JavaCore.COMPILER_TASK_TAGS, ""); //$NON-NLS-1$
  }
  SourceElementParser parser = new SourceElementParser(
    requestor,
    problemFactory,
    new CompilerOptions(options),
    true/*report local declarations*/,
    !createAST /*optimize string literals only if not creating a DOM AST*/);
  parser.reportOnlyOneSyntaxError = !computeProblems;
  parser.setMethodsFullRecovery(true);
  parser.setStatementsRecovery((reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
 
  if (!computeProblems && !resolveBindings && !createAST) // disable javadoc parsing if not computing problems, not resolving and not creating ast
    parser.javadocParser.checkDocComment = false;
  requestor.parser = parser;
  CompilationUnitDeclaration unit = parser.parseCompilationUnit(
    new org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit() {
      public char[] getContents() {
        return contents;
      }
      public char[] getMainTypeName() {
View Full Code Here

public SourceElementParser getSourceElementParser(IJavaProject project, ISourceElementRequestor requestor) {
  // disable task tags to speed up parsing
  Map options = project.getOptions(true);
  options.put(JavaCore.COMPILER_TASK_TAGS, ""); //$NON-NLS-1$
 
  SourceElementParser parser = new IndexingParser(
    requestor,
    new DefaultProblemFactory(Locale.getDefault()),
    new CompilerOptions(options),
    true, // index local declarations
    true, // optimize string literals
View Full Code Here

            );
          }
        }
      }
     
      SourceElementParser parser = this.manager.getSourceElementParser(javaProject, null/*requestor will be set by indexer*/);
      Object[] names = indexedFileNames.keyTable;
      Object[] values = indexedFileNames.valueTable;
      for (int i = 0, namesLength = names.length; i < namesLength; i++) {
        String name = (String) names[i];
        if (name != null) {
View Full Code Here

  }
  public void indexDocument() {
    // Create a new Parser
    SourceIndexerRequestor requestor = new SourceIndexerRequestor(this);
    String documentPath = this.document.getPath();
    SourceElementParser parser = ((InternalSearchDocument) this.document).parser;
    if (parser == null) {
      IPath path = new Path(documentPath);
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
      parser = JavaModelManager.getJavaModelManager().indexManager.getSourceElementParser(JavaCore.create(project), requestor);
    } else {
      parser.requestor = requestor;
    }
   
    // Launch the parser
    char[] source = null;
    char[] name = null;
    try {
      source = document.getCharContents();
      name = documentPath.toCharArray();
    } catch(Exception e){
      // ignore
    }
    if (source == null || name == null) return; // could not retrieve document info (e.g. resource was discarded)
    CompilationUnit compilationUnit = new CompilationUnit(source, name);
    try {
      parser.parseCompilationUnit(compilationUnit, true/*full parse*/);
    } catch (Exception e) {
      if (JobManager.VERBOSE) {
        e.printStackTrace();
      }
    }
View Full Code Here

    try {
      monitor.enterRead(); // ask permission to read

      final IPath container = this.containerPath;
      final IndexManager indexManager = this.manager;
      final SourceElementParser parser = indexManager.getSourceElementParser(JavaCore.create(this.project), null/*requestor will be set by indexer*/);
      if (this.exclusionPatterns == null && this.inclusionPatterns == null) {
        folder.accept(
          new IResourceProxyVisitor() {
            public boolean visit(IResourceProxy proxy) /* throws CoreException */{
              if (proxy.getType() == IResource.FILE) {
View Full Code Here

    this.anonymousCounter = 0;
   
    HashMap oldSourceRanges = (HashMap) this.sourceRanges.clone();
    try {
      IProblemFactory factory = new DefaultProblemFactory();
      SourceElementParser parser = null;
      this.anonymousClassName = 0;
      if (info == null) {
        try {
          info = (IBinaryType) this.binaryType.getElementInfo();
        } catch(JavaModelException e) {
          return null;
        }
      }
      boolean isAnonymousClass = info.isAnonymous();
      char[] fullName = info.getName();
      if (isAnonymousClass) {
        String eltName = this.binaryType.getParent().getElementName();
        eltName = eltName.substring(eltName.lastIndexOf('$') + 1, eltName.length());
        try {
          this.anonymousClassName = Integer.parseInt(eltName);
        } catch(NumberFormatException e) {
          // ignore
        }
      }
      boolean doFullParse = hasToRetrieveSourceRangesForLocalClass(fullName);
      parser = new SourceElementParser(this, factory, new CompilerOptions(this.options), doFullParse, true/*optimize string literals*/);
      parser.javadocParser.checkDocComment = false; // disable javadoc parsing
      IJavaElement javaElement = this.binaryType.getCompilationUnit();
      if (javaElement == null) javaElement = this.binaryType.getParent();
      parser.parseCompilationUnit(
        new BasicCompilationUnit(contents, null, this.binaryType.sourceFileName(info), javaElement),
        doFullParse);
      if (elementToFind != null) {
        ISourceRange range = this.getNameRange(elementToFind);
        return range;
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.SourceElementParser

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.