* Added browser like links (Ctrl+Mouseclick on identifier; same as F3 shortcut)
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / Parser.java
index 73d504e..cc9ce7a 100644 (file)
@@ -1,6 +1,6 @@
 /***********************************************************************************************************************************
- * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material are
- * made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
+ * Copyright (c) 2002 www.phpeclipse.de All rights reserved. This program and the accompanying material are made available under the
+ * terms of the Common Public License v1.0 which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/cpl-v10.html
  * 
  * Contributors: www.phpeclipse.de
@@ -44,6 +44,7 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
 
 public class Parser //extends PHPParserSuperclass
     implements ITerminalSymbols, CompilerModifiers, ParserBasicInformation {
@@ -166,7 +167,9 @@ public class Parser //extends PHPParserSuperclass
   public void initializeScanner() {
     this.scanner = new Scanner(false /* comment */, false /* whitespace */, this.options
         .getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore /* nls */, false, false,
-        this.options.taskTags/* taskTags */, this.options.taskPriorites/* taskPriorities */);
+        this.options.taskTags/* taskTags */, 
+        this.options.taskPriorites/* taskPriorities */,
+        true/*isTaskCaseSensitive*/);
   }
 
   /**
@@ -207,6 +210,12 @@ public class Parser //extends PHPParserSuperclass
     throw new SyntaxError(1, 0, " ", error);
   }
 
+  private void reportSyntaxError(String error) {
+    int problemStartPosition = scanner.getCurrentTokenStartPosition();
+    int problemEndPosition = scanner.getCurrentTokenEndPosition();
+    reportSyntaxError(error, problemStartPosition, problemEndPosition + 1);
+  }
+  
   private void reportSyntaxError(String error, int problemStartPosition, int problemEndPosition) {
     problemReporter.phpParsingError(new String[] { error }, problemStartPosition, problemEndPosition, referenceContext,
         compilationUnit.compilationResult);
@@ -1681,7 +1690,7 @@ public class Parser //extends PHPParserSuperclass
         }
       } else { // TokenNamedefault
         getNextToken();
-        if (token == TokenNameCOLON) {
+        if (token == TokenNameCOLON || token == TokenNameSEMICOLON) {
           getNextToken();
           if (token == TokenNameRBRACE) {
             // empty default case
@@ -3396,10 +3405,16 @@ public class Parser //extends PHPParserSuperclass
           //      System.out.println(new String(compilationUnit.getFileName())+" - "+ expression.toStringExpression());
           IProject project = resource.getProject();
           if (project != null) {
-            if (PHPFileUtil.determineFilePath(includeNameString, resource, project) == null) {
-              reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: "
-                  + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd);
-              //              System.out.println(path.toString() + " - " + expression.toStringExpression());
+            IPath path = PHPFileUtil.determineFilePath(includeNameString, resource, project);
+            
+            if (path == null) {
+              //              reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: "
+              //                  + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd);
+              String[] args = { expression.toStringExpression(), project.getLocation().toString() };
+              problemReporter.phpIncludeNotExistWarning(args, literal.sourceStart, literal.sourceEnd, referenceContext,
+                  compilationUnit.compilationResult);
+            } else {
+              impt.setFile( PHPFileUtil.createFile(path, project) );
             }
           }
         }