/// <summary> /// Interpret YieldStatement /// </summary> /// <param name="statement">YieldStatement to interpret</param> public override void Visit(YieldStatement statement) { if (YieldStack.Count == 0) { return; } //Pop from YieldStack and lets interpet it YieldElement yieldElement = YieldStack.Pop(); if (yieldElement != null && yieldElement.GetRootElement() != null) { //Let's copy yieldstack, because there are possible yields in the yield. Stack <YieldElement> tempYieldStack = new Stack <YieldElement>(); List <YieldElement> yieldList = YieldStack.ToList(); foreach (YieldElement yieldNode in yieldList) { tempYieldStack.Push(yieldNode); } //Lets interpret it with specific symboltable SymbolTable temp = (SymbolTable)SymbolTable.Clone(); SymbolTable = yieldElement.GetSymbolTable(); yieldElement.GetRootElement().AcceptVisitor(this); //Add some content when node is an expression or embedding if (yieldElement.GetRootElement() is Expression || yieldElement.GetRootElement() is Embedding) { XHTMLElement element = new XHTMLElement(TextValue, Current); element.SetTagState(false); AddElement(element); } //Restore symboltable SymbolTable = temp; //Restore YieldStack in original shape before interpreting YieldStack = tempYieldStack; } }