currentTag = builder.substring(0).toLowerCase();
state = State.TAG;
return new OpenTagToken(line, col, builder.toString(), getLineNo(), getColumn());
} else {
builder.append(c);
return new StringToken(line, col, builder.toString(), getLineNo(), getColumn());
}
// Expression
} else if (c == '$' && peek(1) == '{') {
return expressionToken(col, line, false);
} else if (c == '%' && peek(1) == '{') {
return expressionToken(col, line, true);
} else {
ArrayList<ExtensionPoint> extensionPoints = TemplateParser.getExtensionPoints();
if (extensionPoints != null) {
for (ExtensionPoint p : extensionPoints) {
String opener = p.getTagOpener();
int length = opener.length();
if (length > 1 && c == opener.charAt(0) && opener.substring(1).equals(peekString(length - 1))) {
nextChar(length - 1);
return p.getToken(this, col, line);
}
}
}
StringBuilder builder = new StringBuilder();
builder.append(c);
if (consumeScriptTag && "script".equals(currentTag)) {
while (true) {
if (peek(1) == Tokenizer.EOL
|| ("</script".equalsIgnoreCase(peekString(8)))
|| (peek(1) == '%' && peek(2) == '{')
|| (peek(1) == '$' && peek(2) == '{')) {
break;
}
builder.append(nextChar());
}
} else {
while (true) {
if (peek(1) == Tokenizer.EOL
|| (peek(1) == '<' && CharUtil.isName(peek(2)))
|| (peek(1) == '<' && peek(2) == '!')
|| (peek(1) == '<' && peek(2) == '/' && CharUtil.isName(peek(3)))
|| (peek(1) == '$' && peek(2) == '{')
|| (peek(1) == '%' && peek(2) == '{')
) {
break;
}
builder.append(nextChar());
}
}
return new StringToken(line, col, builder.toString(), getLineNo(), getColumn());
}
}