123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Xml;
- namespace NTERA.Interpreter.Compiler
- {
- [DebuggerDisplay("{Type}")]
- public class ExecutionNode
- {
- public string Type { get; set; }
- public Dictionary<string, string> Metadata { get; set; } = new Dictionary<string, string>();
- public string Anchor { get; set; }
- public Marker Symbol { get; set; }
- public ExecutionNode[] SubNodes { get; set; } = new ExecutionNode[0];
- public ExecutionNode this[string type]
- {
- get { return SubNodes.First(x => x.Type == type); }
- }
- public void WriteXml(XmlWriter writer)
- {
- writer.WriteStartElement(Type);
- foreach (var kv in Metadata)
- writer.WriteAttributeString(kv.Key, kv.Value);
- foreach (var node in SubNodes)
- node.WriteXml(writer);
- writer.WriteEndElement();
- }
- }
- }
|