/// <summary> /// Get the next char entry /// </summary> public void GetNextCharsEntry() { // if we have no current string, we use the start pattern and we're done if (CurrentString == null) { // set the current string as starting pattern CurrentString = (char[])StartPattern.Clone(); return; } // get the last "digit" of our char sequence int lastDigit = GetLastDigit(); // increase each "digit" of the characters sequence as a number while (IncreaseDigit(lastDigit) && lastDigit > 0) { lastDigit--; } // when the current string is the same as the final pattern, the search is complete. if (new string( CurrentString ) == new string( EndPattern )) { Completed = true; } }
public override PatternMatchResult GetMatch(List <Token> tokens, int @from = 0) { var beginRes = StartPattern.GetMatch(tokens, from); if (beginRes.IsFullMatch) { var endRes = EndPattern.GetMatch(tokens, beginRes.End); return(new PatternMatchResult(beginRes.Start, endRes.End)); } return(PatternMatchResult.Empty); }