4 types derived from RegexQuery
Microsoft.CodeAnalysis.Workspaces (4)
PatternMatching\RegexQuery.cs (4)
41
public sealed class All(ImmutableArray<RegexQuery> children) :
RegexQuery
51
public sealed class Any(ImmutableArray<RegexQuery> children) :
RegexQuery
64
public sealed class Literal :
RegexQuery
82
public sealed class None :
RegexQuery
61 references to RegexQuery
Microsoft.CodeAnalysis.Features (37)
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (2)
50
/// the pattern contains regex metacharacters. Also compiles a <see cref="
RegexQuery
"/> for
68
var
regexQuery = container is null
NavigateTo\RegexQueryCompiler.cs (34)
15
/// Compiles a regex pattern string into a <see cref="
RegexQuery
"/> tree that can be evaluated
24
/// quantifiers) produce <see cref="
RegexQuery
.None"/>, which means "I can't tell — don't reject
25
/// on my account." If the entire compiled tree is <see cref="
RegexQuery
.None"/> (e.g. for <c>.*</c>),
26
/// <see cref="
RegexQuery
.HasLiterals"/> is <see langword="false"/> and the caller skips pre-filtering
33
/// <see cref="
RegexQuery
"/> tree. Returns <see langword="null"/> if the pattern is not
36
public static
RegexQuery
? Compile(string pattern)
47
/// Compiles an already-parsed regex AST into an optimized <see cref="
RegexQuery
"/> tree.
53
/// When non-null, the returned tree is guaranteed to contain only <see cref="
RegexQuery
.All"/>,
54
/// <see cref="
RegexQuery
.Any"/>, and <see cref="
RegexQuery
.Literal"/> nodes — no
55
/// <see cref="
RegexQuery
.None"/> nodes survive optimization (see
56
/// <see cref="
RegexQuery
.Optimize"/>). Callers can rely on this when traversing the tree.
58
public static
RegexQuery
? Compile(RegexTree tree)
60
var
raw = CompileNode(tree.Root.Expression);
61
var
optimized =
RegexQuery
.Optimize(raw);
65
private static
RegexQuery
CompileNode(RegexNode node)
74
RegexWildcardNode =>
RegexQuery
.None.Instance,
87
RegexZeroOrMoreQuantifierNode =>
RegexQuery
.None.Instance,
88
RegexZeroOrOneQuantifierNode =>
RegexQuery
.None.Instance,
106
_ =>
RegexQuery
.None.Instance,
110
private static
RegexQuery
CompileAlternation(RegexAlternationNode alternation)
115
var children = new FixedSizeArrayBuilder<
RegexQuery
>(alternation.SequenceList.Length);
119
return new
RegexQuery
.Any(children.MoveToImmutable());
122
private static
RegexQuery
CompileSequence(RegexSequenceNode sequence)
127
var children = new FixedSizeArrayBuilder<
RegexQuery
>(sequence.Children.Length);
131
return new
RegexQuery
.All(children.MoveToImmutable());
134
private static
RegexQuery
CompileText(RegexTextNode text)
152
return
RegexQuery
.None.Instance;
154
return new
RegexQuery
.Literal(builder.ToString());
157
private static
RegexQuery
CompileSimpleEscape(RegexSimpleEscapeNode _)
161
return
RegexQuery
.None.Instance;
164
private static
RegexQuery
CompileNumericQuantifier(RegexExpressionNode expression, EmbeddedSyntaxToken<RegexKind> firstNumberToken)
172
return
RegexQuery
.None.Instance;
NavigateTo\SearchPatternInfo.cs (1)
17
RegexQuery
? RegexQuery)
Microsoft.CodeAnalysis.Workspaces (24)
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.cs (3)
40
/// Evaluates a compiled <see cref="PatternMatching.
RegexQuery
"/> against this document's indexed
43
public bool RegexQueryCheckPasses(PatternMatching.
RegexQuery
query)
84
public bool RegexQueryCheckPasses(PatternMatching.
RegexQuery
query)
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.NavigateToSearchInfo.cs (7)
742
/// Evaluates a <see cref="
RegexQuery
"/> tree against this document's indexed bigrams and n-grams.
746
public bool RegexQueryCheckPasses(PatternMatching.
RegexQuery
query)
750
case PatternMatching.
RegexQuery
.All all:
751
foreach (
var
child in all.Children)
759
case PatternMatching.
RegexQuery
.Any any:
760
foreach (
var
child in any.Children)
768
case PatternMatching.
RegexQuery
.Literal literal:
PatternMatching\RegexQuery.cs (14)
41
public sealed class All(ImmutableArray<
RegexQuery
> children) : RegexQuery
43
public readonly ImmutableArray<
RegexQuery
> Children = children;
51
public sealed class Any(ImmutableArray<
RegexQuery
> children) : RegexQuery
53
public readonly ImmutableArray<
RegexQuery
> Children = children;
105
public static
RegexQuery
Optimize(
RegexQuery
query)
114
static
RegexQuery
OptimizeAll(All all)
116
using var _ = Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<
RegexQuery
>.GetInstance(out var children);
118
foreach (
var
child in all.Children)
120
var
optimized = Optimize(child);
145
static
RegexQuery
OptimizeAny(Any any)
147
using var _ = Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<
RegexQuery
>.GetInstance(out var children);
149
foreach (
var
child in any.Children)
151
var
optimized = Optimize(child);