private void UpdateSelection(ParseTree newRoot, CowList<int> path) { if (newRoot != null) { _selectedTreeStack.Clear(); _parseTree = newRoot; _selectedTreeStack.Add(_parseTree.GetNodeAtPath(path)); SelectInEditor(); } }
public ParseTree PrettyPrint() { if (_selectedTreeStack.Count == 0) { return _parseTree; } CowList<int> path = _selectedTreeStack.Last.GetPath(); Console.WriteLine("path of pped node: {0}", path.ToString()); _parseTree = _selectedTreeStack.Last.PrettyPrint(Shell.MaxColumn, _editor); _selectedTreeStack.Clear(); ParseTree previouslySelected = _parseTree.GetNodeAtPath(path); if (previouslySelected != null) { _selectedTreeStack.Add(previouslySelected); SelectInEditor(); } Console.WriteLine(">>> Code tree is:{0}{1}", Environment.NewLine, _parseTree.ToStringAsTree()); UpdateFormatting(); ConsistencyCheck(); return _parseTree; }