コード例 #1
0
 public CandidateDefinition(int position, Match match, TokenDefinition definition)
 {
     Position = position;
     Match = match;
     Definition = definition;
 }
コード例 #2
0
 public CandidateDefinition(int position, Match match, TokenDefinition definition)
 {
     Position   = position;
     Match      = match;
     Definition = definition;
 }
コード例 #3
0
ファイル: RegexTokenizer.cs プロジェクト: jtmueller/sqlformat
        /// <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();
        }