void TagParsed(ILocation location, TagType tagtype, string tagid, TagAttributes attributes)
{
switch (tagtype)
{
case TagType.Close:
if (openObject == null)
{
throw new ParseException(location, "There are more closing tags than opening tags");
}
if (0 != string.Compare(openObject.TagID, tagid))
{
throw new ParseException(location, "Closing tag " + tagid + " does not match opening tag " + openObject.TagID);
}
openObject = openObject.CloseObject(location.PlainText);
break;
case TagType.CodeRender:
throw new NotImplementedException("Code render expressions have not yet been implemented: " + location.PlainText);
//break;
case TagType.CodeRenderExpression:
throw new NotImplementedException("Code render expressions have not yet been implemented: " + location.PlainText);
//break;
case TagType.DataBinding:
throw new NotImplementedException("Data binding expressions have not yet been implemented: " + location.PlainText);
//break;
case TagType.Directive:
ProcessDirective(tagid, attributes);
break;
case TagType.Include:
throw new NotImplementedException("Server-side includes have not yet been implemented: " + location.PlainText);
//break;
case TagType.ServerComment:
throw new NotImplementedException("Server comments have not yet been implemented: " + location.PlainText);
//break;
case TagType.Tag:
//TODO: don't do this for XHTML
if ((string.Compare(tagid, "br", true) == 0) ||
(string.Compare(tagid, "hr", true) == 0))
{
goto case TagType.SelfClosing;
}
openObject = openObject.CreateChildParsingObject(location, tagid, attributes);
break;
case TagType.SelfClosing:
if (openObject == null)
{
throw new Exception("Root tag cannot be self-closing");
}
openObject = openObject.CreateChildParsingObject(location, tagid, attributes);
openObject = openObject.CloseObject(string.Empty);
break;
case TagType.Text:
throw new NotImplementedException("Text tagtypes have not yet been implemented: " + location.PlainText);
//break;
}
}