Putting in quick change to support namespace and const. This change only adds a few...
authorEdward Mann <phpeclipse.dev@edmann.com>
Sun, 31 Oct 2010 05:18:23 +0000 (05:18 +0000)
committerEdward Mann <phpeclipse.dev@edmann.com>
Sun, 31 Oct 2010 05:18:23 +0000 (05:18 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/syntax.xml

index ae1db34..a7d3644 100644 (file)
@@ -235,7 +235,7 @@ public interface ITerminalSymbols {
 
        public final static int TokenNameswitch = 1009;
 
-       public final static int TokenNamecase = 10010;
+       public final static int TokenNamecase = 1010;
 
        public final static int TokenNameendswitch = 1011;
 
@@ -352,7 +352,11 @@ public interface ITerminalSymbols {
        public final static int TokenNameMETHOD_C = 1073;
 
        public final static int TokenNameFUNC_C = 1074;
-
+       
+       public final static int TokenNameNamespace = 1075;
+       
+       public final static int TokenNameForwardSlash = 1076;
+       
        // special tokens not normally used in the parser
        public final static int TokenNamethis_PHP_COMPLETION = 2000;
 }
index e6c6133..3d33858 100644 (file)
@@ -856,6 +856,15 @@ public class Parser implements ITerminalSymbols, CompilerModifiers,
                                getNextToken();
                        }
                        return statement;
+               } else if(token == TokenNameconst){
+                       getNextToken();
+                       if(token == TokenNameIdentifier){
+                               getNextToken();
+                               if(token == TokenNameEQUAL){
+                                       getNextToken();
+                               }
+                               //throwSyntaxError("'Ed i know your here");
+                       }
                } else if (token == TokenNamestatic) {
                        getNextToken();
                        static_var_list();
@@ -2473,6 +2482,8 @@ public class Parser implements ITerminalSymbols, CompilerModifiers,
                        case TokenNameinclude_once:
                        case TokenNamerequire:
                        case TokenNamerequire_once:
+                       case TokenNameNamespace:
+                       case TokenNameconst:
                                internal_functions_in_yacc();
                                break;
                        // | '(' expr ')'
@@ -4091,9 +4102,32 @@ public class Parser implements ITerminalSymbols, CompilerModifiers,
                        // T_REQUIRE_ONCE expr
                        checkFileName(token);
                        break;
+               case TokenNameNamespace:
+                       // NAMESPACE expr
+                       checkNameSpaceName();
+                       break;
+               case TokenNameconst:
+                       getNextToken();
+                       expr();
+                       break;
                }
        }
-
+       
+       /**
+        * parse and check the namespace name
+        * @since 1.2.3
+        * @param namespaceToken
+        */
+       private void checkNameSpaceName(){
+               getNextToken();
+                       while (true) {
+                               if (token == TokenNameSEMICOLON) {
+                                       break;
+                               }
+                               getNextToken();
+                       }
+               
+       }
        /**
         * Parse and check the include file name
         * 
index eeff2c1..5d9f191 100644 (file)
@@ -1648,6 +1648,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
                                                return TokenNameCOLON;
                                        case '@':
                                                return TokenNameAT;
+                                       case '\\':
+                                               return TokenNameForwardSlash;
                                        case '\'':
                                                consumeStringConstant();
                                                return TokenNameStringSingleQuote;
@@ -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'))
@@ -4085,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: