|| !isAllSpace) {
int line = startMark.getLineNumber();
int column = startMark.getColumnNumber();
CharArrayWriter ttext = new CharArrayWriter();
int lastCh = 0, elType = 0;
for (int i = 0; i < charBuffer.length(); i++) {
int ch = charBuffer.charAt(i);
if (ch == '\n') {
column = 1;
line++;
} else {
column++;
}
if ((lastCh == '$' || lastCh == '#') && ch == '{') {
elType = lastCh;
if (ttext.size() > 0) {
new Node.TemplateText(
ttext.toString(),
startMark,
current);
ttext = new CharArrayWriter();
//We subtract two from the column number to
//account for the '[$,#]{' that we've already parsed
startMark = new Mark(ctxt, path, line, column - 2);
}
// following "${" || "#{" to first unquoted "}"
i++;
boolean singleQ = false;
boolean doubleQ = false;
lastCh = 0;
for (;; i++) {
if (i >= charBuffer.length()) {
throw new SAXParseException(
Localizer.getMessage(
"jsp.error.unterminated",
(char) elType + "{"),
locator);
}
ch = charBuffer.charAt(i);
if (ch == '\n') {
column = 1;
line++;
} else {
column++;
}
if (lastCh == '\\' && (singleQ || doubleQ)) {
ttext.write(ch);
lastCh = 0;
continue;
}
if (ch == '}') {
new Node.ELExpression((char) elType,
ttext.toString(),
startMark,
current);
ttext = new CharArrayWriter();
startMark = new Mark(ctxt, path, line, column);
break;
}
if (ch == '"')
doubleQ = !doubleQ;
else if (ch == '\'')
singleQ = !singleQ;
ttext.write(ch);
lastCh = ch;
}
} else if (lastCh == '\\' && (ch == '$' || ch == '#')) {
ttext.write(ch);
ch = 0; // Not start of EL anymore
} else {
if (lastCh == '$' || lastCh == '#' || lastCh == '\\') {
ttext.write(lastCh);
}
if (ch != '$' && ch != '#' && ch != '\\') {
ttext.write(ch);
}
}
lastCh = ch;
}
if (lastCh == '$' || lastCh == '#' || lastCh == '\\') {
ttext.write(lastCh);
}
if (ttext.size() > 0) {
new Node.TemplateText(ttext.toString(), startMark, current);
}
}
startMark = new Mark(ctxt, path, locator.getLineNumber(),
locator.getColumnNumber());