1 11 package org.eclipse.jdt.internal.core.search.indexing; 12 13 import org.eclipse.jdt.core.compiler.CharOperation; 14 import org.eclipse.jdt.internal.compiler.IProblemFactory; 15 import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; 16 import org.eclipse.jdt.internal.compiler.SourceElementParser; 17 import org.eclipse.jdt.internal.compiler.ast.ASTNode; 18 import org.eclipse.jdt.internal.compiler.ast.ImportReference; 19 import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; 20 import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; 21 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; 22 23 26 public class IndexingParser extends SourceElementParser { 27 SingleNameReference singleNameReference = new SingleNameReference(CharOperation.NO_CHAR, 0); 28 QualifiedNameReference qualifiedNameReference = new QualifiedNameReference(CharOperation.NO_CHAR_CHAR, new long[0], 0, 0); 29 ImportReference importReference = new ImportReference(CharOperation.NO_CHAR_CHAR, new long[1], false, 0); 30 31 public IndexingParser(ISourceElementRequestor requestor, IProblemFactory problemFactory, CompilerOptions options, boolean reportLocalDeclarations, boolean optimizeStringLiterals, boolean useSourceJavadocParser) { 32 super(requestor, problemFactory, options, reportLocalDeclarations, 33 optimizeStringLiterals, useSourceJavadocParser); 34 } 35 36 protected ImportReference newImportReference(char[][] tokens, long[] sourcePositions, boolean onDemand, int mod) { 37 ImportReference ref = this.importReference; 38 ref.tokens = tokens; 39 ref.sourcePositions = sourcePositions; 40 if (onDemand) { 41 ref.bits |= ASTNode.OnDemand; 42 } 43 ref.sourceEnd = (int) (sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFF); 44 ref.sourceStart = (int) (sourcePositions[0] >>> 32); 45 ref.modifiers = modifiers; 46 return ref; 47 } 48 49 protected SingleNameReference newSingleNameReference(char[] source, long positions) { 50 SingleNameReference ref = this.singleNameReference; 51 ref.token = source; 52 ref.sourceStart = (int) (positions >>> 32); 53 ref.sourceEnd = (int) positions; 54 return ref; 55 } 56 57 protected QualifiedNameReference newQualifiedNameReference(char[][] tokens, long[] positions, int sourceStart, int sourceEnd) { 58 QualifiedNameReference ref = this.qualifiedNameReference; 59 ref.tokens = tokens; 60 ref.sourcePositions = positions; 61 ref.sourceStart = sourceStart; 62 ref.sourceEnd = sourceEnd; 63 return ref; 64 } 65 } 66 | Popular Tags |