protected override void WriteStartMatch(Capture capture) { ResultStorage?.Add(capture.Value); Write(Options.Indent); if (OutputInfo != null) { Write(OutputInfo.GetText(capture, MatchCount + 1, groupName: Options.GroupName, captureNumber: -1)); } }
protected override void WriteStartMatches() { _lastPos = 0; Write(Options.Indent); if (Options.IncludeLineNumber) { WriteLineNumber(1); } ResultStorage?.Add(Input); }
protected override void WriteStartMatch(ICapture capture) { ResultStorage?.Add(capture.Value); if (MatchCount == 0 || Options.Separator?.EndsWith('\n') != false) { Write(Options.Indent); } if (OutputInfo != null) { Write(OutputInfo.GetText(capture, MatchCount + 1, groupName: Options.GroupName)); } }
protected override void WriteStartMatch(CaptureInfo capture) { ResultStorage?.Add(capture.Value); if (Options.IncludeLineNumber) { _lineNumber += TextHelpers.CountLines(Input, _solIndex, capture.Index - _solIndex); ((LineNumberValueWriter)ValueWriter).LineNumber = _lineNumber; } int solIndex = FindStartOfLine(capture); if (Options.ContextBefore > 0) { WriteContextBefore(0, solIndex, _lineNumber); } Write(Options.Indent); if (Options.IncludeLineNumber) { WriteLineNumber(_lineNumber); } if (capture.Index >= _eolIndex) { MatchingLineCount++; int length = capture.Length; if (length > 0) { if (Input[capture.Index + length - 1] == '\n') { length--; } MatchingLineCount += TextHelpers.CountLines(Input, capture.Index, length); } } _solIndex = solIndex; _eolIndex = FindEndOfLine(capture); WriteStartLine(_solIndex, capture.Index); }
protected override void WriteStartMatch(CaptureInfo capture) { int index = capture.Index; int prevLineNumber = _lineNumber; if (Options.IncludeLineNumber) { _lineNumber += TextHelpers.CountLines(Input, _solIndex, index - _solIndex); ((LineNumberValueWriter)ValueWriter).LineNumber = _lineNumber; } bool isSameBlock = index < _eolIndex; int solIndex = FindStartOfLine(index); if (isSameBlock) { int endIndex = index; if (endIndex > _lastEndIndex) { if (Input[endIndex - 1] == '\r') { endIndex--; } Write(Input, _lastEndIndex, endIndex - _lastEndIndex); } } else { int startIndex = 0; if (_lastEndIndex >= 0) { WriteEndLine(); Write(Options.Separator); if (Options.ContextAfter > 0) { startIndex = WriteContextAfter(_eolIndex, solIndex, prevLineNumber); } else { startIndex = _eolIndex; } } if (Options.ContextBefore > 0) { WriteContextBefore(startIndex, solIndex, _lineNumber); } Write(Options.Indent); if (Options.IncludeLineNumber) { WriteLineNumber(_lineNumber); } MatchingLineCount++; } int length = capture.Length; if (length > 0) { if (Input[index + length - 1] == '\n') { length--; } MatchingLineCount += TextHelpers.CountLines(Input, index, length); } _solIndex = solIndex; _eolIndex = FindEndOfLine(capture); if (!isSameBlock) { WriteStartLine(_solIndex, index); if (ResultStorage != null) { int endIndex = _eolIndex; if (length > 0 && endIndex > 0 && Input[endIndex - 1] == '\n') { endIndex--; if (endIndex > 0 && Input[endIndex - 1] == '\r') { endIndex--; } } ResultStorage.Add(Input, _solIndex, endIndex - _solIndex); } } }
protected override void WriteStartMatch(Capture capture) { int index = capture.Index; if (Options.IncludeLineNumber) { _lineNumber += TextHelpers.CountLines(Input, _solIndex, index - _solIndex); ((LineNumberValueWriter)ValueWriter).LineNumber = _lineNumber; } bool isSameLine = index < _eolIndex; if (isSameLine) { int endIndex = index; if (endIndex > _lastEndIndex) { if (Input[endIndex - 1] == '\r') { endIndex--; } Write(Input, _lastEndIndex, endIndex - _lastEndIndex); } } else { if (_lastEndIndex >= 0) { WriteEndOfLine(); } Write(Options.Indent); if (Options.IncludeLineNumber) { WriteLineNumber(_lineNumber); } MatchingLineCount++; } int length = capture.Length; if (length > 0) { if (Input[index + length - 1] == '\n') { length--; } MatchingLineCount += TextHelpers.CountLines(Input, index, length); } _solIndex = FindStartOfLine(index); _eolIndex = FindEndOfLine(capture); if (!isSameLine) { WriteStartLine(_solIndex, index); if (ResultStorage != null) { int endIndex = _eolIndex; if (endIndex > 0 && Input[endIndex - 1] == '\n') { endIndex--; if (endIndex > 0 && Input[endIndex - 1] == '\r') { endIndex--; } } ResultStorage.Add(Input, _solIndex, endIndex - _solIndex); } } }