コード例 #1
0
 public virtual void Visit(IPgnSymbol node)
 {
     if (node != null)
     {
         node.Accept(this);
     }
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: IPgnSymbol.cs プロジェクト: PenguinF/sandra-three
 /// <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);
コード例 #4
0
 public virtual void DefaultVisit(IPgnSymbol node)
 {
 }
コード例 #5
0
 public override Style DefaultVisit(IPgnSymbol node, PgnEditor pgnEditor)
 => pgnEditor.DefaultStyle;