Putting in quick change to support namespace and const. This change only adds a few...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / Scanner.java
index f230cf3..5d9f191 100644 (file)
@@ -1438,8 +1438,6 @@ public class Scanner implements IScanner, ITerminalSymbols {
 
                                        while ((currentCharacter == ' ')
                                                        || Character.isWhitespace(currentCharacter)) {
-                                               startPosition = currentPosition;
-                                               currentCharacter = source[currentPosition++];
                                                if ((currentCharacter == '\r')
                                                                || (currentCharacter == '\n')) {
                                                        checkNonExternalizeString();
@@ -1449,6 +1447,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
                                                                currentLine = null;
                                                        }
                                                }
+                                               startPosition = currentPosition;
+                                               currentCharacter = source[currentPosition++];
                                        }
                                        if (tokenizeWhiteSpace
                                                        && (whiteStart != currentPosition - 1)) {
@@ -1648,6 +1648,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
                                                return TokenNameCOLON;
                                        case '@':
                                                return TokenNameAT;
+                                       case '\\':
+                                               return TokenNameForwardSlash;
                                        case '\'':
                                                consumeStringConstant();
                                                return TokenNameStringSingleQuote;
@@ -2128,7 +2130,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
                        }
                } catch (IndexOutOfBoundsException e) {
                        phpMode = true;
-                       currentPosition = currentPositionInLine;
+                       currentPosition = currentPositionInLine - 1;
                        return TokenNameINLINE_HTML;
                }
        }
@@ -3562,6 +3564,14 @@ public class Scanner implements IScanner, ITerminalSymbols {
                                if ((data[++index] == 'e') && (data[++index] == 'w'))
                                        return TokenNamenew;
                                return TokenNameIdentifier;
+                       case 9:
+                               //namespace
+                               if ((data[++index] == 'a') && (data[++index] == 'm')
+                                               && (data[++index] == 'e') && (data[++index] == 's')
+                                               && (data[++index] == 'p') && (data[++index] == 'a')
+                                               && (data[++index] == 'c') && (data[++index] == 'e'))
+                                       return TokenNameNamespace;
+                               return TokenNameIdentifier;
                                // case 4 :
                                // if ((data[++index] == 'u') && (data[++index] == 'l')
                                // && (data[++index] == 'l'))
@@ -3698,6 +3708,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
                        case 3:
                                if ((data[++index] == 's') && (data[++index] == 'e'))
                                        return TokenNameuse;
+                               else
+                                       return TokenNameIdentifier;
                        case 5:
                                if ((data[++index] == 'n') && (data[++index] == 's')
                                                && (data[++index] == 'e') && (data[++index] == 't'))
@@ -4083,6 +4095,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
                        return "require"; //$NON-NLS-1$
                case TokenNamerequire_once:
                        return "require_once"; //$NON-NLS-1$
+               case TokenNameNamespace:
+                       return "namespace"; //$NON-NLS-1$
                case TokenNamereturn:
                        return "return"; //$NON-NLS-1$
                        // case TokenNameself: