protected override IEnumerable<ParseStep> GetSuccessParseStep(IRegexEngine engine, State initialState)
{
var matchedText = engine.Input.Substring(initialState.Index, engine.State.Index - initialState.Index);
IList<IList<ParenCapture>> captureSet = new List<IList<ParenCapture>>();
foreach (CapturingParens capturingParen in Children.FindBy(node => node is CapturingParens))
{
var captures = engine.GetCaptures(capturingParen.Number);
captureSet.Add(new ReadOnlyCollection<ParenCapture>(captures.ToList()));
engine.PopCapture(capturingParen.Number);
}
yield return ParseStep.Match(this, initialState, matchedText, new ReadOnlyCollection<IList<ParenCapture>>(captureSet));
if (initialState.Index == engine.State.Index)
{
// If we had a successful match, and the engine didn't move, we need to move it ourselves now.
engine.State = engine.State.Advance();
yield return ParseStep.AdvanceIndex(this, engine.State);
}
yield return ParseStep.BeginParse(this, engine.State);
}