public GolLangParseNode(GolLangLine keywords) { this.line = keywords.clone(); parents = null; leftSibling = null; rightSibling = null; children = new List <GolLangParseNode>(); isVisited = false; }
public void addChild(GolLangParseNode child) { children.Add(child); child.parents = this; if (children.Count > 1) { GolLangParseNode now = children[0]; while (now.rightSibling != null) { now = now.rightSibling; } now.rightSibling = child; child.leftSibling = now; } }
//후위 순회 Enumerator public IEnumerator GetEnumerator() { head.unvisit(); now = head; while (true) { GolLangParseNode temp = now.getFirstUnvisitedChild(); if (temp == null) { if (!now.isVisited) { now.isVisited = true; yield return(now); } if (now.hasRightSibling()) { now = now.rightSibling; } else if (now.parents != null) { now = now.parents; } else { break; } } else { now = temp; } } }
public GolLangParseTree(GolLangParseNode head) { this.head = head; }
public GolLangParseTree() { head = null; }