X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index a19a44d..a1e5351 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -39,9 +39,13 @@ public class Scanner implements IScanner, ITerminalSymbols { public boolean phpMode = false; - public boolean phpExpressionTag = false; - - // public Stack encapsedStringStack = null; + /** + * 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 char currentCharacter; @@ -1288,11 +1292,15 @@ public class Scanner implements IScanner, ITerminalSymbols { } public int getNextToken() throws InvalidInputException { - phpExpressionTag = false; if (!phpMode) { return getInlinedHTMLToken(currentPosition); - } - if (phpMode) { + } else { + if (fFillerToken != TokenNameEOF) { + int tempToken; + tempToken = fFillerToken; + fFillerToken = TokenNameEOF; + return tempToken; + } this.wasAcr = false; if (diet) { jumpOverMethodBody(); @@ -1951,6 +1959,7 @@ public class Scanner implements IScanner, ITerminalSymbols { * @throws InvalidInputException */ private int getInlinedHTMLToken(int start) throws InvalidInputException { + boolean phpShortTag = false; // true, if source.length) { currentPosition = source.length; return TokenNameEOF; @@ -1965,23 +1974,27 @@ public class Scanner implements IScanner, ITerminalSymbols { if ((currentCharacter != 'P') && (currentCharacter != 'p')) { if (currentCharacter != '=') { // = 0) { test = getNextChar('P', 'p'); @@ -2022,10 +2035,11 @@ public class Scanner implements IScanner, ITerminalSymbols { } /** + * check if the PHP is only in this line (for CodeFormatter) + * * @return */ private int lookAheadLinePHPTag() { - // check if the PHP is only in this line (for CodeFormatter) int currentPositionInLine = currentPosition; char previousCharInLine = ' '; char currentCharInLine = ' '; @@ -3534,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')) { @@ -3832,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(); } @@ -3966,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: