4 types derived from RegexQuery
Microsoft.CodeAnalysis.Workspaces (4)
PatternMatching\RegexQuery.cs (4)
41public sealed class All(ImmutableArray<RegexQuery> children) : RegexQuery 51public sealed class Any(ImmutableArray<RegexQuery> children) : RegexQuery 64public sealed class Literal : RegexQuery 82public 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 68var 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 36public 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. 58public static RegexQuery? Compile(RegexTree tree) 60var raw = CompileNode(tree.Root.Expression); 61var optimized = RegexQuery.Optimize(raw); 65private static RegexQuery CompileNode(RegexNode node) 74RegexWildcardNode => RegexQuery.None.Instance, 87RegexZeroOrMoreQuantifierNode => RegexQuery.None.Instance, 88RegexZeroOrOneQuantifierNode => RegexQuery.None.Instance, 106_ => RegexQuery.None.Instance, 110private static RegexQuery CompileAlternation(RegexAlternationNode alternation) 115var children = new FixedSizeArrayBuilder<RegexQuery>(alternation.SequenceList.Length); 119return new RegexQuery.Any(children.MoveToImmutable()); 122private static RegexQuery CompileSequence(RegexSequenceNode sequence) 127var children = new FixedSizeArrayBuilder<RegexQuery>(sequence.Children.Length); 131return new RegexQuery.All(children.MoveToImmutable()); 134private static RegexQuery CompileText(RegexTextNode text) 152return RegexQuery.None.Instance; 154return new RegexQuery.Literal(builder.ToString()); 157private static RegexQuery CompileSimpleEscape(RegexSimpleEscapeNode _) 161return RegexQuery.None.Instance; 164private static RegexQuery CompileNumericQuantifier(RegexExpressionNode expression, EmbeddedSyntaxToken<RegexKind> firstNumberToken) 172return RegexQuery.None.Instance;
NavigateTo\SearchPatternInfo.cs (1)
17RegexQuery? RegexQuery)
Microsoft.CodeAnalysis.Workspaces (24)
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.cs (3)
40/// Evaluates a compiled <see cref="PatternMatching.RegexQuery"/> against this document's indexed 43public bool RegexQueryCheckPasses(PatternMatching.RegexQuery query) 84public 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. 746public bool RegexQueryCheckPasses(PatternMatching.RegexQuery query) 750case PatternMatching.RegexQuery.All all: 751foreach (var child in all.Children) 759case PatternMatching.RegexQuery.Any any: 760foreach (var child in any.Children) 768case PatternMatching.RegexQuery.Literal literal:
PatternMatching\RegexQuery.cs (14)
41public sealed class All(ImmutableArray<RegexQuery> children) : RegexQuery 43public readonly ImmutableArray<RegexQuery> Children = children; 51public sealed class Any(ImmutableArray<RegexQuery> children) : RegexQuery 53public readonly ImmutableArray<RegexQuery> Children = children; 105public static RegexQuery Optimize(RegexQuery query) 114static RegexQuery OptimizeAll(All all) 116using var _ = Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<RegexQuery>.GetInstance(out var children); 118foreach (var child in all.Children) 120var optimized = Optimize(child); 145static RegexQuery OptimizeAny(Any any) 147using var _ = Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<RegexQuery>.GetInstance(out var children); 149foreach (var child in any.Children) 151var optimized = Optimize(child);