/// <summary> /// Converts basic parse tree to text parse tree. /// </summary> /// <param name="input">Text input</param> /// <param name="parseTreeNode">Parse tree for the given text input</param> /// <returns>Text parse tree.</returns> private TextParseTreeNode ToTextParseTree(string input, ParseTreeNode parseTreeNode) { var textParseTreeNode = new TextParseTreeNode( parseTreeNode.RuleName, input, parseTreeNode.StartPosition, parseTreeNode.EndPosition); foreach (var child in parseTreeNode.Children) { textParseTreeNode.AddChild(ToTextParseTree(input, child)); } return(textParseTreeNode); }
/// <summary> /// Adds child parse tree node to the tree. /// </summary> /// <param name="node">Node to add</param> public void AddChild(TextParseTreeNode node) { node.Parent = this; children.Add(node); }