Parser detects wrong include files now
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / UnitParser.java
index d8a0199..f9981b9 100644 (file)
@@ -1,6 +1,5 @@
 package net.sourceforge.phpdt.internal.compiler.parser;
 
-import java.util.Stack;
 
 import net.sourceforge.phpdt.core.IJavaModelMarker;
 import net.sourceforge.phpdt.core.compiler.IProblem;
@@ -8,7 +7,6 @@ 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.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.ConstructorDeclaration;
 import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
@@ -21,16 +19,15 @@ import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 
 /**
- * @author jsurfer
- *
+ * 
  * 
  */
 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();
@@ -100,7 +97,7 @@ public class UnitParser extends Parser {
 
     //         int astLength = astStack.length;
     //         if (noAstNodes.length < astLength){
-    //                 noAstNodes = new AstNode[astLength];
+    //                 noAstNodes = new ASTNode[astLength];
     //                 //System.out.println("Resized AST stacks : "+ astLength);
     //         
     //         }
@@ -143,7 +140,7 @@ public class UnitParser extends Parser {
       goForCompilationUnit();
 
       /* scanner initialization */
-      scanner.setSource(sourceUnit.getContents());
+      scanner.setSource(sourceUnit, sourceUnit.getContents());
 
       /* unit creation */
       referenceContext =
@@ -204,46 +201,12 @@ public class UnitParser extends Parser {
             new Integer(problem.getSourceStart()),
             new Integer(problem.getSourceEnd() + 1),
             new Integer(problem.getSourceLineNumber()),
-            net.sourceforge.phpdt.internal.core.Util.getProblemArgumentsForMarker(problem.getArguments())});
+            net.sourceforge.phpdt.internal.core.util.Util.getProblemArgumentsForMarker(problem.getArguments())});
       }
 
     }
   }
-  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
 
@@ -339,8 +302,8 @@ public class UnitParser extends Parser {
     // field.initialization = expressionStack[expressionPtr];
     // 
     // // mark field with local type if one was found during parsing
-    // if ((type.bits & AstNode.HasLocalTypeMASK) != 0) {
-    //         field.bits |= AstNode.HasLocalTypeMASK;
+    // if ((type.bits & ASTNode.HasLocalTypeMASK) != 0) {
+    //         field.bits |= ASTNode.HasLocalTypeMASK;
     // }       
   }
   // A P I
@@ -374,8 +337,8 @@ public class UnitParser extends Parser {
     // ini.block = ((Initializer) astStack[astPtr]).block;
     // 
     // // mark initializer with local type if one was found during parsing
-    // if ((type.bits & AstNode.HasLocalTypeMASK) != 0) {
-    //         ini.bits |= AstNode.HasLocalTypeMASK;
+    // if ((type.bits & ASTNode.HasLocalTypeMASK) != 0) {
+    //         ini.bits |= ASTNode.HasLocalTypeMASK;
     // }       
   }
   // A P I
@@ -442,7 +405,7 @@ public class UnitParser extends Parser {
       goForCompilationUnit();
 
       /* scanner initialization */
-      scanner.setSource(sourceUnit.getContents());
+      scanner.setSource(sourceUnit, sourceUnit.getContents());
       scanner.resetTo(start, end);
       /* unit creation */
       referenceContext =