} else {
tagName = text;
}
if (state == EOF) {
throw new GrailsTagException(
"Unexpected end of file encountered parsing Tag [" + tagName + "] for " + className +
". Are you missing a closing brace '}'?", pageName,
getCurrentOutputLineNumber());
}
flushTagBuffering();
TagMeta tm = new TagMeta();
tm.name = tagName;
tm.namespace = ns;
tm.hasAttributes = !attrs.isEmpty();
tm.lineNumber = getCurrentOutputLineNumber();
tm.emptyTag = emptyTag;
tm.tagIndex = tagIndex;
tagMetaStack.push(tm);
if (GroovyPage.DEFAULT_NAMESPACE.equals(ns) && tagRegistry.isSyntaxTag(tagName)) {
if (tagContext == null) {
tagContext = new HashMap<Object, Object>();
tagContext.put(GroovyPage.OUT, out);
tagContext.put(GroovyPageParser.class, this);
}
GroovySyntaxTag tag = (GroovySyntaxTag) tagRegistry.newTag(tagName);
tag.init(tagContext);
tag.setAttributes(attrs);
if (tag.isKeepPrecedingWhiteSpace() && currentlyBufferingWhitespace) {
flushBufferedWhiteSpace();
}
else if (!tag.isAllowPrecedingContent() && previousContentWasNonWhitespace) {
throw new GrailsTagException("Tag [" + tag.getName() +
"] cannot have non-whitespace characters directly preceding it.", pageName,
getCurrentOutputLineNumber());
}
else {
// If tag does not specify buffering of WS, we swallow it here