public override void SetTag(string tag) { base.SetTag(tag); // Var is our default tag handler: Handler = TagHandlers.GetHandler("lang-" + Tag, "lang-var"); if (!SelfClosing) { SelfClosing = Handler.SelfClosing(); } VariableTag varTag = Handler as VariableTag; if (varTag != null) { varTag.Element = this; } }
protected override MLElement CreateTagElement(MLLexer lexer) { // Only ever called at the top level - push the new child straight to the language set. LanguageElement result = new LanguageElement(Parent, lexer, true); if (result.Tag == "language") { LanguageTag language = result.Handler as LanguageTag; language.Apply(Parent, result); } else { // Must be a variable - if it isn't, error. VariableTag varTag = result.Handler as VariableTag; if (varTag == null) { throw new Exception("<" + result.Tag + "> not expected here - this file supports only <var>/<v> and <language> at it's top level (anything can go inside var/v though)."); } varTag.Parent = Parent; } return(result); }