public override void Initialize(ParserInitializeArgs args) { base.Initialize(args); separator = Separator ?? args.Grammar.Separator; if (Items.Count == 0) { throw new InvalidOperationException("There are no items in this sequence"); } if (args.Push(this)) { var leftItem = Items[0]; if (leftItem != null) { foreach (var parent in args.RecursionFixes) { if (leftItem.IsLeftRecursive(parent)) { Items[0] = new EmptyParser(); break; } } } foreach (var item in Items.Where(r => r != null)) { item.Initialize(args); } if (Separator != null) { Separator.Initialize(args); } args.Pop(); } }
public override void Initialize(ParserInitializeArgs args) { base.Initialize(args); separator = Separator ?? args.Grammar.Separator; if (Items.Count == 0) throw new InvalidOperationException("There are no items in this sequence"); if (args.Push(this)) { var leftItem = Items[0]; if (leftItem != null) { foreach (var parent in args.RecursionFixes) { if (leftItem.IsLeftRecursive(parent)) { Items[0] = new EmptyParser(); break; } } } foreach (var item in Items.Where(r => r != null)) { item.Initialize(args); } if (Separator != null) Separator.Initialize(args); args.Pop(); } }