Fix bug #1385272: Parsing of short open tags not fully compatible to PHP parse
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / Scanner.java
index 30e835c..a1e5351 100644 (file)
@@ -39,10 +39,13 @@ public class Scanner implements IScanner, ITerminalSymbols {
 
        public boolean phpMode = false;
 
-//     public boolean phpExpressionTag = false;
-
+       /**
+        * This token is set to TokenNameecho if a short tag block begins (i.e. >?= ... )
+        * Directly after the "=" character the getNextToken() method returns TokenNameINLINE_HTML
+        * In the next call to the getNextToken() method the value of fFillerToken (==TokenNameecho) is returned
+        *
+        */
        int fFillerToken = TokenNameEOF;
-       // public Stack encapsedStringStack = null;
 
        public char currentCharacter;
 
@@ -1292,10 +1295,10 @@ public class Scanner implements IScanner, ITerminalSymbols {
                if (!phpMode) {
                        return getInlinedHTMLToken(currentPosition);
                } else {
-                       if (fFillerToken!=TokenNameEOF) {
+                       if (fFillerToken != TokenNameEOF) {
                                int tempToken;
                                tempToken = fFillerToken;
-                               fFillerToken=TokenNameEOF;
+                               fFillerToken = TokenNameEOF;
                                return tempToken;
                        }
                        this.wasAcr = false;
@@ -1956,7 +1959,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
         * @throws InvalidInputException
         */
        private int getInlinedHTMLToken(int start) throws InvalidInputException {
-               boolean phpShortTag = false;  // true, if <?= detected
+               boolean phpShortTag = false; // true, if <?= detected
                if (currentPosition > source.length) {
                        currentPosition = source.length;
                        return TokenNameEOF;
@@ -3545,11 +3548,12 @@ public class Scanner implements IScanner, ITerminalSymbols {
                case 's':
                        // self static switch
                        switch (length) {
-//                     case 4:
-//                             if ((data[++index] == 'e') && (data[++index] == 'l') && (data[++index] == 'f')) {
-//                                     return TokenNameself;
-//                             }
-//                             return TokenNameIdentifier;
+                       // case 4:
+                       // if ((data[++index] == 'e') && (data[++index] == 'l') && (data[++index]
+                       // == 'f')) {
+                       // return TokenNameself;
+                       // }
+                       // return TokenNameIdentifier;
                        case 6:
                                if (data[++index] == 't')
                                        if ((data[++index] == 'a') && (data[++index] == 't') && (data[++index] == 'i') && (data[++index] == 'c')) {
@@ -3843,6 +3847,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
                initialPosition = currentPosition = 0;
                containsAssertKeyword = false;
                withoutUnicodeBuffer = new char[this.source.length];
+               fFillerToken = TokenNameEOF;
                // encapsedStringStack = new Stack();
        }
 
@@ -3977,8 +3982,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
                        return "require_once"; //$NON-NLS-1$
                case TokenNamereturn:
                        return "return"; //$NON-NLS-1$
-//             case TokenNameself:
-//                     return "self"; //$NON-NLS-1$
+                       // case TokenNameself:
+                       // return "self"; //$NON-NLS-1$
                case TokenNamestatic:
                        return "static"; //$NON-NLS-1$
                case TokenNameswitch: