private Action <string> _unmatchedRegexHandler; //suppress / error / external public MemberNameGenerator() { _unmatchedRegexHandler = s => Console.Error.WriteLine("unmatched regex: {0}", s); //Note the order of these is important. Rule of thumb: more specific ones first SyntaxMatching.InitRegexList(out _regexList); }
//covered by unit tests public static bool TryMatchSignature(string sig, out RegexMatcher matcher) { if (_regexList == null) { SyntaxMatching.InitRegexList(out _regexList); } matcher = _regexList.FirstOrDefault(reg => reg.IsMatchSuccessful(sig)); return(matcher != null); }