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 2cb8d91..a22b3c4 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,9 +1,9 @@ package net.sourceforge.phpdt.internal.compiler.parser; -import net.sourceforge.phpdt.core.IJavaModelMarker; -import net.sourceforge.phpdt.core.compiler.IProblem; +//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.ast.ASTNode; +//import net.sourceforge.phpdt.internal.compiler.ast.ASTNode; import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration; import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration; import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration; @@ -14,9 +14,9 @@ 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 org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; +//import org.eclipse.core.resources.IMarker; +//import org.eclipse.core.resources.IResource; +//import org.eclipse.core.runtime.CoreException; /** * @@ -188,41 +188,41 @@ public class UnitParser extends Parser { * problem's range - it has an extra attribute "ID" which holds the * problem's id */ - protected void storeProblemsFor(IResource resource, IProblem[] problems) - throws CoreException { - if (resource == null || problems == null || problems.length == 0) - return; - - for (int i = 0, l = problems.length; i < l; i++) { - IProblem problem = problems[i]; - int id = problem.getID(); - if (id != IProblem.Task) { - IMarker marker = resource - .createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker - .setAttributes( - new String[] { IMarker.MESSAGE, - IMarker.SEVERITY, IJavaModelMarker.ID, - IMarker.CHAR_START, IMarker.CHAR_END, - IMarker.LINE_NUMBER, - IJavaModelMarker.ARGUMENTS }, - new Object[] { - problem.getMessage(), - new Integer( - problem.isError() ? IMarker.SEVERITY_ERROR - : IMarker.SEVERITY_WARNING), - new Integer(id), - new Integer(problem.getSourceStart()), - new Integer(problem.getSourceEnd() + 1), - new Integer(problem - .getSourceLineNumber()), - net.sourceforge.phpdt.internal.core.util.Util - .getProblemArgumentsForMarker(problem - .getArguments()) }); - } - - } - } +// protected void storeProblemsFor(IResource resource, IProblem[] problems) +// throws CoreException { +// if (resource == null || problems == null || problems.length == 0) +// return; +// +// for (int i = 0, l = problems.length; i < l; i++) { +// IProblem problem = problems[i]; +// int id = problem.getID(); +// if (id != IProblem.Task) { +// IMarker marker = resource +// .createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); +// marker +// .setAttributes( +// new String[] { IMarker.MESSAGE, +// IMarker.SEVERITY, IJavaModelMarker.ID, +// IMarker.CHAR_START, IMarker.CHAR_END, +// IMarker.LINE_NUMBER, +// IJavaModelMarker.ARGUMENTS }, +// new Object[] { +// problem.getMessage(), +// new Integer( +// problem.isError() ? IMarker.SEVERITY_ERROR +// : IMarker.SEVERITY_WARNING), +// new Integer(id), +// new Integer(problem.getSourceStart()), +// new Integer(problem.getSourceEnd() + 1), +// new Integer(problem +// .getSourceLineNumber()), +// net.sourceforge.phpdt.internal.core.util.Util +// .getProblemArgumentsForMarker(problem +// .getArguments()) }); +// } +// +// } +// } // A P I @@ -418,33 +418,33 @@ public class UnitParser extends Parser { // A P I - public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, - CompilationResult compilationResult, int start, int end) { - // parses a compilation unit and manages error handling (even bugs....) - - CompilationUnitDeclaration unit; - try { - /* automaton initialization */ - initialize(false); - goForCompilationUnit(); - - /* scanner initialization */ - scanner.setSource(sourceUnit, sourceUnit.getContents()); - scanner.resetTo(start, end); - /* unit creation */ - referenceContext = compilationUnit = new CompilationUnitDeclaration( - problemReporter, compilationResult, scanner.source.length); - - /* run automaton */ - parse(); - } catch (SyntaxError syntaxError) { - // - } finally { - unit = compilationUnit; - compilationUnit = null; // reset parser - } - return unit; - } +// public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, +// CompilationResult compilationResult, int start, int end) { +// // parses a compilation unit and manages error handling (even bugs....) +// +// CompilationUnitDeclaration unit; +// try { +// /* automaton initialization */ +// initialize(false); +// goForCompilationUnit(); +// +// /* scanner initialization */ +// scanner.setSource(sourceUnit, sourceUnit.getContents()); +// scanner.resetTo(start, end); +// /* unit creation */ +// referenceContext = compilationUnit = new CompilationUnitDeclaration( +// problemReporter, compilationResult, scanner.source.length); +// +// /* run automaton */ +// parse(); +// } catch (SyntaxError syntaxError) { +// // +// } finally { +// unit = compilationUnit; +// compilationUnit = null; // reset parser +// } +// return unit; +// } public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) { @@ -465,52 +465,52 @@ public class UnitParser extends Parser { return parsedUnit; } - public void getMethodBodies(CompilationUnitDeclaration unit) { - // fill the methods bodies in order for the code to be generated - - if (unit == null) - return; - - if (unit.ignoreMethodBodies) { - unit.ignoreFurtherInvestigation = true; - return; - // if initial diet parse did not work, no need to dig into method - // bodies. - } - - if ((unit.bits & ASTNode.HasAllMethodBodies) != 0) - return; // work already done ... - - // real parse of the method.... - char[] contents = unit.compilationResult.compilationUnit.getContents(); - this.scanner.setSource(contents); - - // save existing values to restore them at the end of the parsing - // process - // see bug 47079 for more details - int[] oldLineEnds = this.scanner.lineEnds; - int oldLinePtr = this.scanner.linePtr; - - final int[] lineSeparatorPositions = unit.compilationResult.lineSeparatorPositions; - this.scanner.lineEnds = lineSeparatorPositions; - this.scanner.linePtr = lineSeparatorPositions.length - 1; - - // if (this.javadocParser != null && this.javadocParser.checkDocComment) - // { - // this.javadocParser.scanner.setSource(contents); - // } - if (unit.types != null) { - for (int i = unit.types.size(); --i >= 0;) - ((TypeDeclaration) unit.types.get(i)).parseMethod(this, unit); - } - - // tag unit has having read bodies - unit.bits |= ASTNode.HasAllMethodBodies; - - // this is done to prevent any side effects on the compilation unit - // result - // line separator positions array. - this.scanner.lineEnds = oldLineEnds; - this.scanner.linePtr = oldLinePtr; - } +// public void getMethodBodies(CompilationUnitDeclaration unit) { +// // fill the methods bodies in order for the code to be generated +// +// if (unit == null) +// return; +// +// if (unit.ignoreMethodBodies) { +// unit.ignoreFurtherInvestigation = true; +// return; +// // if initial diet parse did not work, no need to dig into method +// // bodies. +// } +// +// if ((unit.bits & ASTNode.HasAllMethodBodies) != 0) +// return; // work already done ... +// +// // real parse of the method.... +// char[] contents = unit.compilationResult.compilationUnit.getContents(); +// this.scanner.setSource(contents); +// +// // save existing values to restore them at the end of the parsing +// // process +// // see bug 47079 for more details +// int[] oldLineEnds = this.scanner.lineEnds; +// int oldLinePtr = this.scanner.linePtr; +// +// final int[] lineSeparatorPositions = unit.compilationResult.lineSeparatorPositions; +// this.scanner.lineEnds = lineSeparatorPositions; +// this.scanner.linePtr = lineSeparatorPositions.length - 1; +// +// // if (this.javadocParser != null && this.javadocParser.checkDocComment) +// // { +// // this.javadocParser.scanner.setSource(contents); +// // } +// if (unit.types != null) { +// for (int i = unit.types.size(); --i >= 0;) +// ((TypeDeclaration) unit.types.get(i)).parseMethod(this, unit); +// } +// +// // tag unit has having read bodies +// unit.bits |= ASTNode.HasAllMethodBodies; +// +// // this is done to prevent any side effects on the compilation unit +// // result +// // line separator positions array. +// this.scanner.lineEnds = oldLineEnds; +// this.scanner.linePtr = oldLinePtr; +// } }