private IEnumerable <OMatch <TValue> > GetAllMathes(TValue[] values, int startIndex = -1) { var handler = new SequenceHandler <TValue>(values) { Reverse = Options.HasFlag(ORegexOptions.ReverseSequence) }; startIndex = GetStartIndex(handler, startIndex); var captureTable = new OCaptureTable <TValue>(_fa.CaptureNames); for (int i = startIndex; i <= handler.Count; i++) { Range range; if (_fa.TryRun(handler, i, captureTable, out range)) { bool beginMatched = range.Index == startIndex; bool endMatched = range.RightIndex == handler.Count; if (!_fa.ExactBegin && !_fa.ExactEnd || !(beginMatched ^ _fa.ExactBegin) && !(endMatched ^ _fa.ExactEnd)) { var match = new OMatch <TValue>(handler, captureTable, range); captureTable.Add(0, match); yield return(match); } captureTable = new OCaptureTable <TValue>(_fa.CaptureNames); i += range.Length == 0 ? 0 : range.Length - 1; } if (_fa.ExactBegin) { break; } } }
internal OMatch(SequenceHandler <TValue> handler, OCaptureTable <TValue> table, Range range) : base(handler, range) { Captures = table; }