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