currentTag = null;
return new TagEndToken(line, col, "/>", getLineNo(), getColumn());
} else {
return new TagStringToken(line, col, "/", getLineNo(), getColumn());
}
// TAG END
} else if (c == '>') {
state = State.INITIAL_STATE;
return new TagEndToken(line, col, ">", getLineNo(), getColumn());
} else if (c == '$' && peek(1) == '{') {
return expressionToken(col, line, false);
} else if (c == '%' && peek(1) == '{') {
return expressionToken(col, line, true);
} else if (c == '=') {
state = State.TAG_EXPECTING_ATT_VALUE;
return new AssignToken(line, col, "=", getLineNo(), getColumn());
// ATTRIBUTES -- Somewhere betweeen <X and >
} else if (CharUtil.isName(c)) {
// These characters should not be here...
if (c == '\'') {
return new TagStringToken(line, col, "'", getLineNo(), getColumn());
}
if (c == '"') {
return new TagStringToken(line, col, "\"", getLineNo(), getColumn());
}
StringBuilder builder = new StringBuilder();
char peek = peek(1);
builder.append(c);
while (CharUtil.isNameChar(peek)) {
builder.append(nextChar());
peek = peek(1);
}
return new AttributeNameToken(line, col, builder.toString(), getLineNo(), getColumn());
} 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);
while (!Character.isWhitespace(peek(1)) && peek(1) != '>' && !CharUtil.isName(peek(1))) {
builder.append(nextChar());
}
return new TagStringToken(line, col, builder.toString(), getLineNo(), getColumn());
}
}