public CandidateDefinition(int position, Match match, TokenDefinition definition) { Position = position; Match = match; Definition = definition; }
/// <summary> /// Returns the number of matches that the current token could be /// </summary> /// <param name="token"></param> /// <param name="definition"></param> /// <returns></returns> private int MatchCount(string token, out TokenDefinition definition) { var definitions = TokenDefinitions.ToList(); if (!IsQuote(_currentQuoteType)) definitions.RemoveAll(d => d.WithinQuotesOnly); var matches = definitions.Where( tokenDefinition => tokenDefinition.Regex.Matches(token).Cast<Match>().Any(match => match.Value == token) ); definition = matches.FirstOrDefault(); return matches.Count(); }