import java.util.ArrayList;
+import net.sourceforge.phpdt.internal.compiler.CompilationResult;
+
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit;
import net.sourceforge.phpdt.internal.compiler.env.ISourceType;
+import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
public SourceElementParser(
final ISourceElementRequestor requestor,
- IProblemFactory problemFactory) {
-// CompilerOptions options) {
+ 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,
+ options,
problemFactory) {
public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {
unitResult.record(problem, referenceContext);
typeNames = new char[4][];
superTypeNames = new char[4][];
nestedTypeIndex = 0;
-// this.options = options;
+ this.options = options;
}
/** @deprecated use SourceElementParser(ISourceElementRequestor, IProblemFactory, CompilerOptions) */
// diet = old;
}
}
-public void parseCompilationUnit(
- ICompilationUnit unit,
- boolean needReferenceInfo) {
-// boolean old = diet;
-// if (needReferenceInfo) {
-// unknownRefs = new NameReference[10];
-// unknownRefsCounter = 0;
-// }
+public CompilationUnitDeclaration parseCompilationUnit(
+ ICompilationUnit unit,
+ boolean fullParse) {
+
+// boolean old = diet;
+// if (fullParse) {
+// unknownRefs = new NameReference[10];
+// unknownRefsCounter = 0;
+// }
- try {
-// diet = true;
- reportReferenceInfo = needReferenceInfo;
- CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, 10); //this.options.maxProblemsPerUnit);
- CompilationUnitDeclaration parsedUnit = parse(unit, compilationUnitResult);
- if (scanner.recordLineSeparator) {
- requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ try {
+// diet = true;
+ this.reportReferenceInfo = fullParse;
+ CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.options.maxProblemsPerUnit);
+ CompilationUnitDeclaration parsedUnit = parse(unit, compilationUnitResult, false);
+ if (scanner.recordLineSeparator) {
+ requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
+ }
+ int initialStart = this.scanner.initialPosition;
+ int initialEnd = this.scanner.eofPosition;
+// if (this.localDeclarationVisitor != null || fullParse){
+// diet = false;
+// this.getMethodBodies(parsedUnit);
+// }
+ this.scanner.resetTo(initialStart, initialEnd);
+ notifySourceElementRequestor(parsedUnit);
+ return parsedUnit;
+ } catch (AbortCompilation e) {
+ // ignore this exception
+ } finally {
+// diet = old;
}
- int initialStart = this.scanner.initialPosition;
- int initialEnd = this.scanner.eofPosition;
-// if (this.localDeclarationVisitor != null || needReferenceInfo){
-// diet = false;
-// this.getMethodBodies(parsedUnit);
-// }
- this.scanner.resetTo(initialStart, initialEnd);
- notifySourceElementRequestor(parsedUnit);
- } catch (AbortCompilation e) {
- } finally {
-// diet = old;
+ return null;
}
-}
+
//public void parseTypeMemberDeclarations(
// ISourceType sourceType,
// ICompilationUnit sourceUnit,