void AppendText(string textToAppend, Stack<SyntaxTreeNode> stack)
{
var currentNode = stack.Peek();
var lastChild = currentNode.SubNodes.Count == 0 ? null : currentNode.SubNodes[currentNode.SubNodes.Count - 1] as TextNode;
TextNode newChild;
if (lastChild == null)
newChild = new TextNode(textToAppend, TextNodeHtmlTemplate);
else
newChild = new TextNode(lastChild.Text + textToAppend, TextNodeHtmlTemplate);
if (currentNode.SubNodes.Count != 0 && currentNode.SubNodes[currentNode.SubNodes.Count - 1] is TextNode)
currentNode.SubNodes[currentNode.SubNodes.Count - 1] = newChild;
else
currentNode.SubNodes.Add(newChild);
}