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;
}
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();
* @throws InvalidInputException
*/
private int getInlinedHTMLToken(int start) throws InvalidInputException {
+ boolean phpShortTag = false; // true, if <?= detected
if (currentPosition > source.length) {
currentPosition = source.length;
return TokenNameEOF;
if ((currentCharacter != 'P') && (currentCharacter != 'p')) {
if (currentCharacter != '=') { // <?=
currentPosition--;
+ phpShortTag = false;
} else {
- phpExpressionTag = true;
+ phpShortTag = true;
}
// <?
if (ignorePHPOneLiner) { // for CodeFormatter
if (lookAheadLinePHPTag() == TokenNameINLINE_HTML) {
phpMode = true;
+ if (phpShortTag) {
+ fFillerToken = TokenNameecho;
+ }
return TokenNameINLINE_HTML;
}
} else {
phpMode = true;
+ if (phpShortTag) {
+ fFillerToken = TokenNameecho;
+ }
return TokenNameINLINE_HTML;
}
} else {
- // boolean phpStart = (currentCharacter == 'P') ||
- // (currentCharacter == 'p');
- // if (phpStart) {
int test = getNextChar('H', 'h');
if (test >= 0) {
test = getNextChar('P', 'p');
}
/**
+ * 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 = ' ';
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')) {
initialPosition = currentPosition = 0;
containsAssertKeyword = false;
withoutUnicodeBuffer = new char[this.source.length];
+ fFillerToken = TokenNameEOF;
// encapsedStringStack = new Stack();
}
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: