public boolean ignorePHPOneLiner = false;
public boolean phpMode = false;
-
+
+ public boolean phpExpressionTag = false;
+
public Stack encapsedStringStack = null;
public char currentCharacter;
}
public int getNextToken() throws InvalidInputException {
+ phpExpressionTag = false;
if (!phpMode) {
- return getInlinedHTML(currentPosition);
+ return getInlinedHTMLToken(currentPosition);
}
if (phpMode) {
this.wasAcr = false;
phpMode = true;
return TokenNameINLINE_HTML;
}
- return getInlinedHTML(currentPosition - 2);
+ return getInlinedHTMLToken(currentPosition - 2);
}
return TokenNameQUESTION;
case ':':
return TokenNameEOF;
}
- private int getInlinedHTML(int start) throws InvalidInputException {
- int token = getInlinedHTMLToken(start);
- if (token == TokenNameINLINE_HTML) {
- // Stack stack = new Stack();
- // // scan html for errors
- // Source inlinedHTMLSource = new Source(new String(source, startPosition, currentPosition - startPosition));
- // int lastPHPEndPos=0;
- // for (Iterator i=inlinedHTMLSource.getNextTagIterator(0); i.hasNext();) {
- // Tag tag=(Tag)i.next();
- //
- // if (tag instanceof StartTag) {
- // StartTag startTag=(StartTag)tag;
- // // System.out.println("startTag: "+tag);
- // if (startTag.isServerTag()) {
- // // TODO : what to do with a server tag ?
- // } else {
- // // do whatever with HTML start tag
- // // use startTag.getElement() to find the element corresponding
- // // to this start tag which may be useful if you implement code
- // // folding etc
- // stack.push(startTag);
- // }
- // } else {
- // EndTag endTag=(EndTag)tag;
- // StartTag stag = (StartTag) stack.peek();
- //// System.out.println("endTag: "+tag);
- // // do whatever with HTML end tag.
- // }
- // }
- }
- return token;
- }
-
/**
* @return
* @throws InvalidInputException
if ((currentCharacter != 'P') && (currentCharacter != 'p')) {
if (currentCharacter != '=') { // <?=
currentPosition--;
+ } else {
+ phpExpressionTag = true;
}
// <?
- if (ignorePHPOneLiner) {
+ if (ignorePHPOneLiner) { // for CodeFormatter
if (lookAheadLinePHPTag() == TokenNameINLINE_HTML) {
phpMode = true;
return TokenNameINLINE_HTML;
return TokenNameEOF;
}
break;
+ case '\\':
+ if (doubleQuotedStringActive) {
+ // ignore escaped characters in double quoted strings
+ previousCharInLine = currentCharInLine;
+ currentCharInLine = source[currentPositionInLine++];
+ }
case '\"':
if (doubleQuotedStringActive) {
- if (previousCharInLine != '\\') {
- doubleQuotedStringActive = false;
- }
+ doubleQuotedStringActive = false;
} else {
if (!singleQuotedStringActive) {
doubleQuotedStringActive = true;