public virtual void Visit(IPgnSymbol node) { if (node != null) { node.Accept(this); } }
/// <summary> /// Gets if this syntax is a terminal symbol, i.e. if it has no child nodes and its <see cref="Length"/> is greater than zero. /// </summary> /// <param name="pgnTerminalSymbol"> /// The terminal symbol if this syntax is a terminal symbol, otherwise a default value. /// </param> /// <returns> /// Whether or not this syntax is a terminal symbol, i.e. if it has no child nodes and its <see cref="Length"/> is greater than zero. /// </returns> public bool IsTerminalSymbol(out IPgnSymbol pgnTerminalSymbol) { if (ChildCount == 0 && Length > 0) { // Contract is that all subclasses with ChildCount == 0 and Length > 0 must implement IPgnSymbol. pgnTerminalSymbol = (IPgnSymbol)this; return(true); } pgnTerminalSymbol = default; return(false); }
/// <summary> /// Converts this <see cref="IPgnSymbol"/> to a <see cref="PgnSyntax"/> node. /// </summary> /// <param name="pgnSymbol"> /// The <see cref="IPgnSymbol"/> to convert. /// </param> /// <returns> /// The converted <see cref="PgnSyntax"/> node. /// </returns> public static PgnSyntax ToSyntax(this IPgnSymbol pgnSymbol) => pgnSymbol.Accept(ToPgnSyntaxConverter.Instance);
public virtual void DefaultVisit(IPgnSymbol node) { }
public override Style DefaultVisit(IPgnSymbol node, PgnEditor pgnEditor) => pgnEditor.DefaultStyle;