internal ValueTuple <int, int>?Parse(IList <string> lines, IList <QuoteMarkMatchingResult> matchedLinesQuoteMark) { Prepare(); _lines = lines; for (int lineIndex = 0; lineIndex < lines.Count; lineIndex++) { string line = lines[lineIndex]; ResetSingleLineFeatures(oldLineIndex: lineIndex - _headerLinesCount, all: false); bool anyFeatureMatches = false; _featureSet.ForEach(feature => { if (feature.Matches(line)) { UpdateSingleLineFeature(lineIndex, feature); anyFeatureMatches = true; } }); if (_middleColonFeature.Matches(line)) { UpdateMultiLineFeature(lineIndex); anyFeatureMatches = true; } if (_phraseFeature.Matches(line)) { UpdatePhraseFeature(lineIndex); } if (anyFeatureMatches) { ResetFeatures(oldLineIndex: lineIndex - _headerLinesCount); } else { ResetFeatures(all: true); } if (HeaderFound(matchedLinesQuoteMark)) { return(IdentifyHeader()); } } return(null); }
public void ShouldMatchPhraseRegex(string line) { Assert.True(_phraseFeature.Matches(line)); }