using System.Text; using System.Xml.Linq; namespace SqlLinq.SyntaxTree { public abstract class SyntaxNode { public NonTerminalNode Parent { get; internal set; } public int Index { get; internal set; } protected SyntaxNode() { } private string _treeId; public string TreeId { get { if (_treeId == null) { StringBuilder builder = new StringBuilder(); GetTreeId(builder); _treeId = builder.ToString(); } return _treeId; } } protected void GetTreeId(StringBuilder builder) { if (Parent != null) { Parent.GetTreeId(builder); builder.AppendFormat(":{0}:", Index); } else { builder.AppendFormat("root"); } } public abstract XElement ToXml(); } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
10 PRINT "Don is cool" 20 GOTO 10