45 references to Matcher
Microsoft.CodeAnalysis.Workspaces (45)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (13)
19private readonly Matcher<SyntaxTrivia> _oneOrMoreBlankLines; 24private readonly Matcher<SyntaxTrivia> _bannerMatcher; 29private readonly Matcher<SyntaxTrivia> _fileBannerMatcher; 33var whitespace = Matcher.Repeat( 35var endOfLine = Matcher.Single<SyntaxTrivia>(this.SyntaxFacts.IsEndOfLineTrivia, "\\n"); 36var singleBlankLine = Matcher.Sequence(whitespace, endOfLine); 38var shebangComment = Matcher.Single<SyntaxTrivia>(this.SyntaxFacts.IsShebangDirectiveTrivia, "#!"); 39var singleLineComment = Matcher.Single<SyntaxTrivia>(this.SyntaxFacts.IsSingleLineCommentTrivia, "//"); 40var multiLineComment = Matcher.Single<SyntaxTrivia>(this.SyntaxFacts.IsMultiLineCommentTrivia, "/**/"); 41var singleLineDocumentationComment = Matcher.Single<SyntaxTrivia>(this.SyntaxFacts.IsSingleLineDocCommentTrivia, "///"); 42var multiLineDocumentationComment = Matcher.Single<SyntaxTrivia>(this.SyntaxFacts.IsMultiLineDocCommentTrivia, "/** */"); 43var anyCommentMatcher = Matcher.Choice(shebangComment, singleLineComment, multiLineComment, singleLineDocumentationComment, multiLineDocumentationComment); 45var commentLine = Matcher.Sequence(whitespace, anyCommentMatcher, whitespace, endOfLine);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Matcher.ChoiceMatcher.cs (4)
11private sealed class ChoiceMatcher(params Matcher<T>[] matchers) : Matcher<T> 13private readonly IEnumerable<Matcher<T>> _matchers = matchers; 18foreach (var matcher in _matchers)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Matcher.cs (14)
14public static Matcher<T> Repeat<T>(Matcher<T> matcher) 15=> Matcher<T>.Repeat(matcher); 20public static Matcher<T> OneOrMore<T>(Matcher<T> matcher) 21=> Matcher<T>.OneOrMore(matcher); 26public static Matcher<T> Choice<T>(params Matcher<T>[] matchers) 27=> Matcher<T>.Choice(matchers); 32public static Matcher<T> Sequence<T>(params Matcher<T>[] matchers) 33=> Matcher<T>.Sequence(matchers); 38public static Matcher<T> Single<T>(Func<T, bool> predicate, string description) 39=> Matcher<T>.Single(predicate, description);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Matcher.RepeatMatcher.cs (2)
11private sealed class RepeatMatcher(Matcher<T> matcher) : Matcher<T>
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Matcher.SequenceMatcher.cs (2)
11private sealed class SequenceMatcher(params Matcher<T>[] matchers) : Matcher<T>
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Matcher.SingleMatcher.cs (1)
12private sealed class SingleMatcher(Func<T, bool> predicate, string description) : Matcher<T>
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Matcher`1.cs (9)
22internal static Matcher<T> Repeat(Matcher<T> matcher) 25internal static Matcher<T> OneOrMore(Matcher<T> matcher) 31internal static Matcher<T> Choice(params Matcher<T>[] matchers) 34internal static Matcher<T> Sequence(params Matcher<T>[] matchers) 37internal static Matcher<T> Single(Func<T, bool> predicate, string description)