import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation;
import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter;
import net.sourceforge.phpdt.internal.core.util.CommentRecorderParser;
+import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode;
import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.AnonymousLocalTypeDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.Argument;
-import net.sourceforge.phpeclipse.internal.compiler.ast.AstNode;
import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.ExplicitConstructorCall;
import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference;
+import org.eclipse.core.resources.IResource;
+
/**
* A source element parser extracts structural and reference information
* from a piece of source.
public SourceElementParser(final ISourceElementRequestor requestor, IProblemFactory problemFactory, CompilerOptions options) {
// we want to notify all syntax error with the acceptProblem API
// To do so, we define the record method of the ProblemReporter
- super(new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
+ super( new ProblemReporter(DefaultErrorHandlingPolicies.exitAfterAllProblems(), options, problemFactory) {
public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {
unitResult.record(problem, referenceContext);
if (requestor!=null) {
// new SingleNameReference(
// identifierStack[identifierPtr],
// identifierPositionStack[identifierPtr--]);
- // ref.bits &= ~AstNode.RestrictiveFlagMASK;
+ // ref.bits &= ~ASTNode.RestrictiveFlagMASK;
// ref.bits |= LOCAL | FIELD;
// if (reportReferenceInfo) {
// this.addUnknownRef(ref);
// (int) (identifierPositionStack[identifierPtr + 1] >> 32),
// // sourceStart
// (int) identifierPositionStack[identifierPtr + length]); // sourceEnd
- // ref.bits &= ~AstNode.RestrictiveFlagMASK;
+ // ref.bits &= ~ASTNode.RestrictiveFlagMASK;
// ref.bits |= LOCAL | FIELD;
// if (reportReferenceInfo) {
// this.addUnknownRef(ref);
// }
// collect the top level ast nodes
int length = 0;
- AstNode[] nodes = null;
+ ASTNode[] nodes = null;
if (sourceType == null) {
if (isInRange) {
requestor.enterCompilationUnit();
// (currentPackage == null ? 0 : 1)
// + (imports == null ? 0 : imports.length)
// + (types == null ? 0 : types.length);
- // nodes = new AstNode[length];
+ // nodes = new ASTNode[length];
length = (imports == null ? 0 : imports.length) + types.size();
- nodes = new AstNode[length];
+ nodes = new ASTNode[length];
int index = 0;
// if (currentPackage != null) {
// nodes[index++] = currentPackage;
}
for (int i = 0, max = types.size(); i < max; i++) {
- nodes[index++] = (AstNode) types.get(i);
+ nodes[index++] = (ASTNode) types.get(i);
}
}
} else {
ArrayList types = parsedUnit.types;
if (types != null) {
length = types.size();
- nodes = new AstNode[length];
+ nodes = new ASTNode[length];
for (int i = 0, max = types.size(); i < max; i++) {
- nodes[i] = (AstNode) types.get(i);
+ nodes[i] = (ASTNode) types.get(i);
}
}
}
if (nodes != null && length > 0) {
quickSort(nodes, 0, length - 1);
for (int i = 0; i < length; i++) {
- AstNode node = nodes[i];
+ ASTNode node = nodes[i];
if (node instanceof ImportReference) {
ImportReference importRef = (ImportReference)node;
// if (node == parsedUnit.currentPackage) {
// }
}
public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolean notifyTypePresence) {
- //// public void notifySourceElementRequestor(AstNode typeDeclaration,
+ //// public void notifySourceElementRequestor(ASTNode typeDeclaration,
// boolean notifyTypePresence) {
// range check
/**
* Sort the given ast nodes by their positions.
*/
- private static void quickSort(AstNode[] sortedCollection, int left, int right) {
+ private static void quickSort(ASTNode[] sortedCollection, int left, int right) {
int original_left = left;
int original_right = right;
- AstNode mid = sortedCollection[(left + right) / 2];
+ ASTNode mid = sortedCollection[(left + right) / 2];
do {
while (sortedCollection[left].sourceStart < mid.sourceStart) {
left++;
right--;
}
if (left <= right) {
- AstNode tmp = sortedCollection[left];
+ ASTNode tmp = sortedCollection[left];
sortedCollection[left] = sortedCollection[right];
sortedCollection[right] = tmp;
left++;
}
private void visitIfNeeded(AbstractMethodDeclaration method) {
- if (this.localDeclarationVisitor != null && (method.bits & AstNode.HasLocalTypeMASK) != 0) {
+ if (this.localDeclarationVisitor != null && (method.bits & ASTNode.HasLocalTypeMASK) != 0) {
if (method.statements != null) {
int statementsLength = method.statements.length;
for (int i = 0; i < statementsLength; i++)
//private void visitIfNeeded(FieldDeclaration field) {
// if (this.localDeclarationVisitor != null
- // && (field.bits & AstNode.HasLocalTypeMASK) != 0) {
+ // && (field.bits & ASTNode.HasLocalTypeMASK) != 0) {
// if (field.initialization != null) {
// field.initialization.traverse(this.localDeclarationVisitor, null);
// }
//
//private void visitIfNeeded(Initializer initializer) {
// if (this.localDeclarationVisitor != null
- // && (initializer.bits & AstNode.HasLocalTypeMASK) != 0) {
+ // && (initializer.bits & ASTNode.HasLocalTypeMASK) != 0) {
// if (initializer.block != null) {
// initializer.block.traverse(this.localDeclarationVisitor, null);
// }