X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java index 316c046..3a40512 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/UnitParser.java @@ -1,13 +1,12 @@ package net.sourceforge.phpdt.internal.compiler.parser; + import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.CompilationResult; import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation; import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter; -import net.sourceforge.phpdt.internal.compiler.util.Util; -import net.sourceforge.phpdt.internal.core.BasicCompilationUnit; import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration; @@ -27,9 +26,9 @@ import org.eclipse.core.runtime.CoreException; public class UnitParser extends Parser { public UnitParser(ProblemReporter problemReporter) { //, boolean optimizeStringLiterals, boolean assertMode) { - super(); + super(problemReporter); nestedMethod = new int[30]; - this.problemReporter = problemReporter; + // this.optimizeStringLiterals = optimizeStringLiterals; // this.assertMode = assertMode; // this.initializeScanner(); @@ -161,8 +160,7 @@ public class UnitParser extends Parser { // storeProblemsFor(((BasicCompilationUnit)sourceUnit).getResource(), compilationResult.getAllProblems()); // } // // jsurfer end - } catch (CoreException e) { - e.printStackTrace(); + } finally { unit = compilationUnit; compilationUnit = null; // reset parser @@ -209,41 +207,7 @@ public class UnitParser extends Parser { } } - protected CompilationUnitDeclaration endParse(int act) { - - this.lastAct = act; - if (currentElement != null) { - currentElement.topElement().updateParseTree(); - if (VERBOSE_RECOVERY) { - System.out.print(Util.bind("parser.syntaxRecovery")); //$NON-NLS-1$ - System.out.println("--------------------------"); //$NON-NLS-1$ - System.out.println(compilationUnit); - System.out.println("----------------------------------"); //$NON-NLS-1$ - } - } else { - if (diet & VERBOSE_RECOVERY) { - System.out.print(Util.bind("parser.regularParse")); //$NON-NLS-1$ - System.out.println("--------------------------"); //$NON-NLS-1$ - System.out.println(compilationUnit); - System.out.println("----------------------------------"); //$NON-NLS-1$ - } - } - if (scanner.recordLineSeparator) { - compilationUnit.compilationResult.lineSeparatorPositions = scanner.getLineEnds(); - } - if (scanner.taskTags != null) { - for (int i = 0; i < scanner.foundTaskCount; i++) { - problemReporter().task( - new String(scanner.foundTaskTags[i]), - new String(scanner.foundTaskMessages[i]), - scanner.foundTaskPriorities[i] == null ? null : new String(scanner.foundTaskPriorities[i]), - scanner.foundTaskPositions[i][0], - scanner.foundTaskPositions[i][1]); - } - } - return compilationUnit; - } // A P I @@ -265,9 +229,7 @@ public class UnitParser extends Parser { parse(); } catch (AbortCompilation ex) { lastAct = ERROR_ACTION; - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } finally { nestedMethod[nestedType]--; } @@ -330,9 +292,6 @@ public class UnitParser extends Parser { parse(); } catch (AbortCompilation ex) { lastAct = ERROR_ACTION; - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } finally { nestedMethod[nestedType]--; } @@ -368,9 +327,6 @@ public class UnitParser extends Parser { parse(); } catch (AbortCompilation ex) { lastAct = ERROR_ACTION; - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } finally { nestedMethod[nestedType]--; } @@ -389,52 +345,53 @@ public class UnitParser extends Parser { // A P I public void parse(MethodDeclaration md, CompilationUnitDeclaration unit) { - //only parse the method body of md - //fill out method statements - - //convert bugs into parse error - - if (md.isAbstract()) - return; - // if (md.isNative()) - // return; - // if ((md.modifiers & AccSemicolonBody) != 0) - // return; - - initialize(false); - goForMethodBody(); - nestedMethod[nestedType]++; - - referenceContext = md; - compilationUnit = unit; - - scanner.resetTo(md.sourceEnd + 1, md.declarationSourceEnd); - // reset the scanner to parser from { down to } - try { - parse(); - } catch (AbortCompilation ex) { - lastAct = ERROR_ACTION; - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - nestedMethod[nestedType]--; - } - - // if (lastAct == ERROR_ACTION) { - // return; - // } - // - // //refill statements - // md.explicitDeclarations = realBlockStack[realBlockPtr--]; - // int length; - // if ((length = astLengthStack[astLengthPtr--]) != 0) - // System.arraycopy( - // astStack, - // (astPtr -= length) + 1, - // md.statements = new Statement[length], - // 0, - // length); +// TODO jsurfer - make the parse process work on methods ? + return; + +// //only parse the method body of md +// //fill out method statements +// +// //convert bugs into parse error +// +// if (md.isAbstract()) +// return; +// // if (md.isNative()) +// // return; +// // if ((md.modifiers & AccSemicolonBody) != 0) +// // return; +// +// initialize(false); +// goForMethodBody(); +// nestedMethod[nestedType]++; +// +// referenceContext = md; +// compilationUnit = unit; +// +// scanner.resetTo(md.sourceEnd + 1, md.declarationSourceEnd); +// +// // reset the scanner to parser from { down to } +// try { +// parse(); +// } catch (AbortCompilation ex) { +// lastAct = ERROR_ACTION; +// } finally { +// nestedMethod[nestedType]--; +// } +// +// // if (lastAct == ERROR_ACTION) { +// // return; +// // } +// // +// // //refill statements +// // md.explicitDeclarations = realBlockStack[realBlockPtr--]; +// // int length; +// // if ((length = astLengthStack[astLengthPtr--]) != 0) +// // System.arraycopy( +// // astStack, +// // (astPtr -= length) + 1, +// // md.statements = new Statement[length], +// // 0, +// // length); } // A P I @@ -456,9 +413,6 @@ public class UnitParser extends Parser { compilationUnit = new CompilationUnitDeclaration(problemReporter, compilationResult, scanner.source.length); /* run automaton */ parse(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } catch (SyntaxError syntaxError) { // } finally {