public override IEnumerable <Parser> Children(ParserChildrenArgs args) { if (Inner != null && args.Push(this)) { yield return(Inner); foreach (var child in Inner.Children(args)) { yield return(child); } args.Pop(); } }
public override IEnumerable <Parser> Children(ParserChildrenArgs args) { if (args.Push(this)) { var items = Items.Where(r => r != null); foreach (var item in items) { yield return(item); foreach (var child in item.Children(args)) { yield return(child); } } args.Pop(); } }
public override IEnumerable <Parser> Children(ParserChildrenArgs args) { if (args.Push(this)) { for (int i = 0; i < Items.Count; i++) { var item = Items[i]; if (item == null) { continue; } yield return(item); foreach (var child in item.Children(args)) { yield return(child); } } args.Pop(); } }
/// <summary> /// Gets an enumeration of all child parsers of this instance /// </summary> /// <remarks> /// Implementors of parsers should implement this, and call <see cref="ParserChain.Push"/> and <see cref="ParserChain.Pop"/> /// before calling the Children method of contained parsers. /// </remarks> /// <param name="args">Arguments to get the children</param> public virtual IEnumerable <Parser> Children(ParserChildrenArgs args) { yield break; }