From e6030fa04a8de3fdae1dc19d081bf5feb3d3d73c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Sat, 3 Aug 2019 19:49:15 +0200 Subject: sample directory --- Samples/CrowIDE/src/Editors/CodeBuffer/Node.cs | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Samples/CrowIDE/src/Editors/CodeBuffer/Node.cs (limited to 'Samples/CrowIDE/src/Editors/CodeBuffer/Node.cs') diff --git a/Samples/CrowIDE/src/Editors/CodeBuffer/Node.cs b/Samples/CrowIDE/src/Editors/CodeBuffer/Node.cs new file mode 100644 index 00000000..9db55428 --- /dev/null +++ b/Samples/CrowIDE/src/Editors/CodeBuffer/Node.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; + +namespace Crow.Coding +{ + public class Node + { + public Node Parent; + public string Name; + public string Type; + public CodeLine StartLine; + public CodeLine EndLine; + public Dictionary Attributes = new Dictionary (); + + public List Children = new List(); + + public Node () + { + } + + public void AddChild (Node child) { + child.Parent = this; + Children.Add (child); + } + + public int Level { + get { return Parent == null ? 1 : Parent.Level + 1; } + } + + public override string ToString () + { + return string.Format ("Name:{0}, Type:{1}\n\tparent:{2}", Name, Type, Parent); + } + } +} + -- cgit v1.3.1-4-g156e