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;
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;
/**
*
public void goForConstructorBody() {
// tells the scanner to go for compilation unit parsing
- firstToken = TokenNameEQUAL_EQUAL;
+ firstToken = TokenName.EQUAL_EQUAL;
scanner.recordLineSeparator = false;
}
public void goForExpression() {
// tells the scanner to go for an expression parsing
- firstToken = TokenNameREMAINDER;
+ firstToken = TokenName.REMAINDER;
scanner.recordLineSeparator = false;
}
public void goForCompilationUnit() {
// tells the scanner to go for compilation unit parsing
- firstToken = TokenNamePLUS_PLUS;
+ firstToken = TokenName.PLUS_PLUS;
scanner.linePtr = -1;
scanner.foundTaskCount = 0;
scanner.recordLineSeparator = true;
public void goForInitializer() {
// tells the scanner to go for initializer parsing
- firstToken = TokenNameRIGHT_SHIFT;
+ firstToken = TokenName.RIGHT_SHIFT;
scanner.recordLineSeparator = false;
}
public void goForMethodBody() {
// tells the scanner to go for method body parsing
- firstToken = TokenNameMINUS_MINUS;
+ firstToken = TokenName.MINUS_MINUS;
scanner.recordLineSeparator = false;
}
* 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
// 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) {
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;
+// }
}