public void consumeStringLiteral() throws InvalidInputException {
try {
- boolean openDollarBrace = false;
+ int openDollarBrace = 0;
// consume next character
unicodeAsBackSlash = false;
currentCharacter = source[currentPosition++];
- while (currentCharacter != '"' || openDollarBrace) {
+ while (currentCharacter != '"' || openDollarBrace>0) {
/** ** in PHP \r and \n are valid in string literals *** */
if (currentCharacter == '\\') {
int escapeSize = currentPosition;
}
}
} else if (currentCharacter == '$' && source[currentPosition] == '{') {
- openDollarBrace = true;
+ openDollarBrace++;
} else if (currentCharacter == '{' && source[currentPosition] == '$') {
- openDollarBrace = true;
+ openDollarBrace++;
} else if (currentCharacter == '}') {
- openDollarBrace = false;
+ openDollarBrace--;
} else if ((currentCharacter == '\r') || (currentCharacter == '\n')) {
if (recordLineSeparator) {
pushLineSeparator();
return TokenNameINLINE_HTML;
}
} else {
- phpMode = true;
+ boolean foundXML=false;
+ if (getNextChar('X','x')>=0) {
+ if (getNextChar('M','m')>=0) {
+ if (getNextChar('L','l')>=0) {
+ foundXML=true;
+ }
+ }
+ }
+ if (!foundXML) {
+ phpMode = true;
+ }
if (phpShortTag) {
fFillerToken = TokenNameECHO_INVISIBLE;
}
return TokenNameINLINE_HTML;
}
} else {
- int test = getNextChar('H', 'h');
- if (test >= 0) {
- test = getNextChar('P', 'p');
- if (test >= 0) {
+ if (getNextChar('H', 'h') >= 0) {
+ if (getNextChar('P', 'p') >= 0) {
// <?PHP <?php
if (ignorePHPOneLiner) {
if (lookAheadLinePHPTag() == TokenNameINLINE_HTML) {