59 instantiations of RegexNode
System.Text.RegularExpressions (59)
System\Text\RegularExpressions\RegexNode.cs (26)
95new RegexNode(Kind, Options, Str!) : 96new RegexNode(Kind, Options, Ch); 121return new RegexNode(RegexNodeKind.One, options & ~RegexOptions.IgnoreCase, ch); 127return new RegexNode(RegexNodeKind.Set, options & ~RegexOptions.IgnoreCase, stringSet); 131return new RegexNode(RegexNodeKind.One, options, ch); 207RegexNode loopAsChild = new(RegexNodeKind.Loop, Options, M, N); 428parent.InsertChild(1, new RegexNode(RegexNodeKind.UpdateBumpalong, node.Options)); 501var atomic = new RegexNode(RegexNodeKind.Atomic, existingChild.Options); 6150 => new RegexNode(Kind == RegexNodeKind.Alternate ? RegexNodeKind.Nothing : RegexNodeKind.Empty, Options), 706return new RegexNode(RegexNodeKind.Empty, child.Options); 896return new RegexNode(RegexNodeKind.Nothing, Options); 935u = u.M == 0 ? new RegexNode(RegexNodeKind.Empty, Options) : child; 1023return new RegexNode(RegexNodeKind.Nothing, Options); 1261var newAlternate = new RegexNode(RegexNodeKind.Alternate, alternation.Options); 1271var atomic = new RegexNode(RegexNodeKind.Atomic, alternation.Options); 1278var newConcat = new RegexNode(RegexNodeKind.Concatenate, alternation.Options); 1429new RegexNode(RegexNodeKind.One, startingNodeOptions, startingSpan[0]) : 1430new RegexNode(RegexNodeKind.Multi, startingNodeOptions, startingSpan.ToString()); 1431var newAlternate = new RegexNode(RegexNodeKind.Alternate, startingNodeOptions); 1475var atomic = new RegexNode(RegexNodeKind.Atomic, startingNodeOptions); 1480var newConcat = new RegexNode(RegexNodeKind.Concatenate, startingNodeOptions); 1628return new RegexNode(RegexNodeKind.Empty, Options); 2220AddChild(new RegexNode(RegexNodeKind.Empty, Options)); 2238AddChild(new RegexNode(RegexNodeKind.Empty, Options)); 2993return new RegexNode(RegexNodeKind.Empty, Options); 3021var result = new RegexNode(lazy ? RegexNodeKind.Lazyloop : RegexNodeKind.Loop, Options, min, max);
System\Text\RegularExpressions\RegexParser.cs (33)
277StartGroup(new RegexNode(RegexNodeKind.Capture, (_options & ~RegexOptions.IgnoreCase), 0, -1)); 347_unit = new RegexNode(RegexNodeKind.Set, _options & ~RegexOptions.IgnoreCase, setString); 394_unit = new RegexNode((_options & RegexOptions.Multiline) != 0 ? RegexNodeKind.Bol : RegexNodeKind.Beginning, _options); 398_unit = new RegexNode((_options & RegexOptions.Multiline) != 0 ? RegexNodeKind.Eol : RegexNodeKind.EndZ, _options); 403new RegexNode(RegexNodeKind.Set, _options & ~RegexOptions.IgnoreCase, RegexCharClass.AnyClass) : 404new RegexNode(RegexNodeKind.Notone, _options & ~RegexOptions.IgnoreCase, '\n'); 521_concatenation = new RegexNode(RegexNodeKind.Concatenate, _options); 759return new RegexNode(RegexNodeKind.Group, _options); 763return new RegexNode(RegexNodeKind.Capture, _options, _autocap++, -1); 937return new RegexNode(RegexNodeKind.Capture, _options, capnum, uncapnum); 959return new RegexNode(RegexNodeKind.BackreferenceConditional, _options, capnum); 973return new RegexNode(RegexNodeKind.BackreferenceConditional, _options, tmpCapnum); 1026return new RegexNode(nodeType, _options); 1091new RegexNode(TypeFromCode(ch), _options); 1096new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.ECMAWordClass : RegexCharClass.WordClass); 1101new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.NotECMAWordClass : RegexCharClass.NotWordClass); 1106new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.ECMASpaceClass : RegexCharClass.SpaceClass); 1111new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.NotECMASpaceClass : RegexCharClass.NotSpaceClass); 1116new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.ECMADigitClass : RegexCharClass.DigitClass); 1121new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.NotECMADigitClass : RegexCharClass.NotDigitClass); 1138return new RegexNode(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), cc.ToStringClass()); 1203IsCaptureSlot(capnum) ? new RegexNode(RegexNodeKind.Backreference, _options, capnum) : 1235return scanOnly ? null : new RegexNode(RegexNodeKind.Backreference, _options, capnum); 1249return new RegexNode(RegexNodeKind.Backreference, _options, capnum); 1269_capnames?[capname] is int tmpCapnum ? new RegexNode(RegexNodeKind.Backreference, _options, tmpCapnum) : 1345return new RegexNode(RegexNodeKind.Backreference, _options, capnum); 1355return new RegexNode(RegexNodeKind.Backreference, _options, capnum); 1367return new RegexNode(RegexNodeKind.Backreference, _options, tmpCapnum); 1405return new RegexNode(RegexNodeKind.Backreference, _options, capnum); 2022_concatenation!.AddChild(new RegexNode(RegexNodeKind.Multi, _options & ~RegexOptions.IgnoreCase, _pattern.Substring(pos, cch))); 2068_alternation = new RegexNode(RegexNodeKind.Alternate, _options); 2069_concatenation = new RegexNode(RegexNodeKind.Concatenate, _options); 2086_concatenation = new RegexNode(RegexNodeKind.Concatenate, _options);
317 references to RegexNode
System.Text.RegularExpressions (317)
System\Text\RegularExpressions\RegexCompiler.cs (53)
1247(RegexNode LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal) target = _regexTree.FindOptimizations.LiteralAfterLoop.Value; 1431RegexNode node = _regexTree.Root; 1646void EmitAlternation(RegexNode node) 1851void EmitBackreference(RegexNode node) 2026void EmitBackreferenceConditional(RegexNode node) 2041RegexNode yesBranch = node.Child(0); 2042RegexNode? noBranch = node.Child(1) is { Kind: not RegexNodeKind.Empty } childNo ? childNo : null; 2185void EmitExpressionConditional(RegexNode node) 2198RegexNode condition = node.Child(0); 2202RegexNode yesBranch = node.Child(1); 2203RegexNode? noBranch = node.Child(2) is { Kind: not RegexNodeKind.Empty } childNo ? childNo : null; 2385void EmitCapture(RegexNode node, RegexNode? subsequent = null) 2404RegexNode child = node.Child(0); 2511void EmitPositiveLookaroundAssertion(RegexNode node) 2539RegexNode child = node.Child(0); 2562void EmitNegativeLookaroundAssertion(RegexNode node) 2594RegexNode child = node.Child(0); 2685void EmitNode(RegexNode node, RegexNode? subsequent = null, bool emitLengthChecksIfRequired = true) 2827void EmitAtomic(RegexNode node, RegexNode? subsequent) 2832RegexNode child = node.Child(0); 2869void EmitUpdateBumpalong(RegexNode node) 2889void EmitConcatenation(RegexNode node, RegexNode? subsequent, bool emitLengthChecksIfRequired) 2943static RegexNode? GetSubsequent(int index, RegexNode node, RegexNode? subsequent) 2948RegexNode next = node.Child(i); 2960void EmitSingleChar(RegexNode node, bool emitLengthCheck = true, LocalBuilder? offset = null) 3035void EmitBoundary(RegexNode node) 3095void EmitAnchors(RegexNode node) 3233void EmitMultiChar(RegexNode node, bool emitLengthCheck) 3285void EmitSingleCharLoop(RegexNode node, RegexNode? subsequent = null, bool emitLengthChecksIfRequired = true) 3406subsequent?.FindStartingLiteralNode() is RegexNode literal && 3501void EmitSingleCharLazy(RegexNode node, RegexNode? subsequent = null, bool emitLengthChecksIfRequired = true) 3605subsequent?.FindStartingLiteral() is RegexNode.StartingLiteralData literal && 3747subsequent?.FindStartingLiteralNode() is RegexNode literal2 && 3848void EmitLazy(RegexNode node) 3855RegexNode child = node.Child(0); 4210void EmitSingleCharRepeater(RegexNode node, bool emitLengthChecksIfRequired = true) 4228case <= RegexNode.MultiVsRepeaterLimit when node.IsOneFamily: 4359void EmitSingleCharAtomicLoop(RegexNode node) 4606void EmitAtomicSingleCharZeroOrOne(RegexNode node) 4695void EmitNonBacktrackingRepeater(RegexNode node) 4733void EmitLoop(RegexNode node) 4739RegexNode child = node.Child(0); 5131bool CanEmitIndexOf(RegexNode node, out int literalLength) 5164void EmitIndexOf(RegexNode node, bool useLast, bool negate) 5356RegexNode root = _regexTree!.Root.Child(0);
System\Text\RegularExpressions\RegexFindOptimizations.cs (6)
18public static RegexFindOptimizations Create(RegexNode root, RegexOptions options) 24RegexPrefixAnalyzer.FindLeadingPositiveLookahead(root) is RegexNode positiveLookahead) 46private RegexFindOptimizations(RegexNode root, RegexOptions options, bool isLeadingPartial) 217(RegexNode LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal)? literalAfterLoop = RegexPrefixAnalyzer.FindLiteralFollowingLeadingLoop(root); 336public (RegexNode LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal)? LiteralAfterLoop { get; } 820(RegexNode loopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) literal) = LiteralAfterLoop.GetValueOrDefault();
System\Text\RegularExpressions\RegexNode.cs (135)
19/// <remarks>null if no children, a <see cref="RegexNode"/> if one child, or a <see cref="List{RegexNode}"/> if multiple children.</remarks> 49public RegexNode? Parent; 87public RegexNode CloneCharLoopWithOneLessIteration() 94RegexNode newNode = IsSetFamily ? 110public static RegexNode CreateOneWithCaseConversion(char ch, RegexOptions options, CultureInfo? culture, ref RegexCaseBehavior caseBehavior) 135public RegexNode ReverseConcatenationIfRightToLeft() 141((List<RegexNode>)Children!).Reverse(); 207RegexNode loopAsChild = new(RegexNodeKind.Loop, Options, M, N); 245var toExamine = new Stack<RegexNode>(); 249RegexNode node = toExamine.Pop(); 255RegexNode child = node.Child(i); 369internal RegexNode FinalOptimize() 371RegexNode rootNode = this; 409RegexNode node = rootNode.Child(0); // skip implicit root capture node 462RegexNode node = this; 497RegexNode existingChild = node.Child(node.ChildCount() - 1); 501var atomic = new RegexNode(RegexNodeKind.Atomic, existingChild.Options); 574internal RegexNode Reduce() 610private RegexNode ReplaceNodeIfUnnecessary() 627private RegexNode ReduceGroup() 631RegexNode u = this; 648private RegexNode ReduceAtomic() 660RegexNode atomic = this; 661RegexNode child = Child(0); 698List<RegexNode>? branches = child.Children as List<RegexNode>; 739RegexNode startNode = branches[start]; 775RegexNode nextChild = branches[next]; 824private RegexNode ReduceLoops() 828RegexNode u = this; 836RegexNode child = u.Child(0); 904RegexNode child = u.Child(0); 955private RegexNode ReduceSet() 1016private RegexNode ReduceAlternation() 1030RegexNode node = ReplaceNodeIfUnnecessary(); 1075RegexNode at; 1076RegexNode prev; 1078List<RegexNode> children = (List<RegexNode>)Children!; 1090if (at.Children is List<RegexNode> atChildren) 1100RegexNode atChild = (RegexNode)at.Children!; 1193static RegexNode ExtractCommonPrefixNode(RegexNode alternation) 1196Debug.Assert(alternation.Children is List<RegexNode> { Count: >= 2 }); 1197var children = (List<RegexNode>)alternation.Children; 1206foreach (RegexNode child in children) 1216Debug.Assert(children[startingIndex].Children is List<RegexNode> { Count: >= 2 }); 1222RegexNode required = children[startingIndex].Child(0); 1242RegexNode other = children[endingIndex].Child(0); 1261var newAlternate = new RegexNode(RegexNodeKind.Alternate, alternation.Options); 1264((List<RegexNode>)children[i].Children!).RemoveAt(0); 1269if (alternation.Parent is RegexNode { Kind: RegexNodeKind.Atomic }) 1271var atomic = new RegexNode(RegexNodeKind.Atomic, alternation.Options); 1278var newConcat = new RegexNode(RegexNodeKind.Concatenate, alternation.Options); 1292static RegexNode RemoveRedundantEmptiesAndNothings(RegexNode node) 1296var children = (List<RegexNode>)node.Children!; 1302RegexNode child = children[i]; 1335static RegexNode ExtractCommonPrefixText(RegexNode alternation) 1338Debug.Assert(alternation.Children is List<RegexNode> { Count: >= 2 }); 1339var children = (List<RegexNode>)alternation.Children; 1356RegexNode? startingNode = children[startingIndex].FindBranchOneOrMultiStart(); 1428var prefix = startingSpan.Length == 1 ? 1431var newAlternate = new RegexNode(RegexNodeKind.Alternate, startingNodeOptions); 1434RegexNode branch = children[i]; 1441static void ProcessOneOrMulti(RegexNode node, ReadOnlySpan<char> startingSpan) 1473if (alternation.Parent is RegexNode parent && parent.Kind == RegexNodeKind.Atomic) 1475var atomic = new RegexNode(RegexNodeKind.Atomic, startingNodeOptions); 1480var newConcat = new RegexNode(RegexNodeKind.Concatenate, startingNodeOptions); 1498public RegexNode? FindBranchOneOrMultiStart() 1500RegexNode branch = Kind == RegexNodeKind.Concatenate ? Child(0) : this; 1513public RegexNode? FindStartingLiteralNode(bool allowZeroWidth = true) 1515RegexNode? node = this; 1553if (FindStartingLiteralNode() is RegexNode node) 1620private RegexNode ReduceConcatenation() 1637RegexNode child = Child(i); 1665Debug.Assert(Children is List<RegexNode>); 1671List<RegexNode> children = (List<RegexNode>)Children!; 1674RegexNode at = children[i]; 1684if (at.Children is List<RegexNode> atChildren) 1694RegexNode atChild = (RegexNode)at.Children!; 1712RegexNode prev = children[--j]; 1748Debug.Assert(Children is List<RegexNode>); 1750var children = (List<RegexNode>)Children!; 1755RegexNode currentNode = children[current]; 1756RegexNode nextNode = children[next]; 1956Debug.Assert(Children is List<RegexNode>); 1957var children = (List<RegexNode>)Children; 1962static void ProcessNode(RegexNode node, RegexNode subsequent) 2024RegexNode loopChild = node.Child(0); 2052RegexNode child = node.Child(0); 2062RegexNode child = node.Child(0); 2093private RegexNode ReduceLookaround() 2110static bool RemoveCaptures(RegexNode parent, int nodeIndex) 2112RegexNode node = parent.Child(nodeIndex); 2140RegexNode child = Child(0); 2179private static bool? ContainsKind(RegexNode node, ReadOnlySpan<RegexNodeKind> kinds) 2209private RegexNode ReduceBackreferenceConditional() 2227private RegexNode ReduceExpressionConditional() 2246RegexNode condition = Child(0); 2265private static bool CanBeMadeAtomic(RegexNode node, RegexNode subsequent, bool iterateNullableSubsequent, bool allowLazy) 2430RegexNode loopChild = node.Child(0); 2485RegexNode? parent = subsequent.Parent; 2495var peers = (List<RegexNode>)parent.Children!; 2532RegexNode node = this; 2539node.Parent is not RegexNode parent) 2553var peers = (List<RegexNode>)parent.Children!; 2853RegexNode child = Child(i); 2945static bool CanJoinLengthCheck(RegexNode node) => node.Kind switch 2956RegexNode child = Child(childIndex); 2984public RegexNode MakeQuantifier(bool lazy, int min, int max) 3021var result = new RegexNode(lazy ? RegexNodeKind.Lazyloop : RegexNodeKind.Loop, Options, min, max); 3027public void AddChild(RegexNode newChild) 3037else if (Children is RegexNode currentChild) 3039Children = new List<RegexNode>() { currentChild, newChild }; 3043((List<RegexNode>)Children).Add(newChild); 3047public void InsertChild(int index, RegexNode newChild) 3049Debug.Assert(Children is List<RegexNode>); 3055((List<RegexNode>)Children).Insert(index, newChild); 3058public void ReplaceChild(int index, RegexNode newChild) 3067if (Children is RegexNode) 3073((List<RegexNode>)Children)[index] = newChild; 3077public RegexNode Child(int i) => Children is RegexNode child ? child : ((List<RegexNode>)Children!)[i]; 3086if (Children is List<RegexNode> children) 3091Debug.Assert(Children is RegexNode); 3122static bool ExceedsMaxDepthAllowedDepth(RegexNode node, int allowedDepth) 3156RegexNode? curNode = this;
System\Text\RegularExpressions\RegexNodeKind.cs (42)
6/// <summary>Specifies the kind of a <see cref="RegexNode"/>.</summary> 16/// <remarks>The character is specified in <see cref="RegexNode.Ch"/>.</remarks> 19/// <remarks>The character is specified in <see cref="RegexNode.Ch"/>.</remarks> 22/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>.</remarks> 26/// <remarks>The characters are specified in <see cref="RegexNode.Str"/>. This is purely a representational optimization, equivalent to multiple <see cref="One"/> nodes concatenated together.</remarks> 31/// The character is specified in <see cref="RegexNode.Ch"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>. 36/// <remarks>The character is specified in <see cref="RegexNode.Ch"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 40/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 45/// <remarks>The character is specified in <see cref="RegexNode.Ch"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 49/// <remarks>The character is specified in <see cref="RegexNode.Ch"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 53/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>.</remarks> 59/// The character is specified in <see cref="RegexNode.Ch"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>. 65/// The character is specified in <see cref="RegexNode.Ch"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>. 71/// The <see cref="RegexCharClass"/> set string is specified in <see cref="RegexNode.Str"/>, the minimum number of iterations in <see cref="RegexNode.M"/>, and the maximum number of iterations in <see cref="RegexNode.N"/>. 77/// <remarks>The capture group number referenced is stored in <see cref="RegexNode.M"/>.</remarks> 126/// <summary>A loop around an arbitrary <see cref="RegexNode"/>, e.g. `(ab|cd)*`.</summary> 128/// One and only one child, the expression in the loop. The minimum number of iterations is in <see cref="RegexNode.M"/>, 129/// and the maximum number of iterations is in <see cref="RegexNode.N"/>. 132/// <summary>A lazy loop around an arbitrary <see cref="RegexNode"/>, e.g. `(ab|cd)*?`.</summary> 134/// One and only one child, the expression in the loop. The minimum number of iterations is in <see cref="RegexNode.M"/>, 135/// and the maximum number of iterations is in <see cref="RegexNode.N"/>. 141/// One and only one child, the expression in the capture. <see cref="RegexNode.M"/> is the number of the capture, and if a balancing 142/// group, <see cref="RegexNode.N"/> is the uncapture. 169/// The referenced capture group number is stored in <see cref="RegexNode.M"/>.
System\Text\RegularExpressions\RegexOpcode.cs (1)
151/// For quantified constructs with a minimum of zero (<see cref="RegexNode.M"/> == 0), this opcode pushes a counter
System\Text\RegularExpressions\RegexParser.cs (23)
24private RegexNode? _stack; 25private RegexNode? _group; 26private RegexNode? _alternation; 27private RegexNode? _concatenation; 28private RegexNode? _unit; 109RegexNode root = parser.ScanRegex(); 144RegexNode root = parser.ScanReplacement(); 270private RegexNode ScanRegex() 332_unit = RegexNode.CreateOneWithCaseConversion(_pattern[endpos - 1], _options, _culture, ref _caseBehavior); 353if (ScanGroupOpen() is RegexNode grouper) 519private RegexNode ScanReplacement() 748private RegexNode? ScanGroupOpen() 1076private RegexNode? ScanBackslash(bool scanOnly) 1141RegexNode? result = ScanBasicBackslash(scanOnly); 1151private RegexNode? ScanBasicBackslash(bool scanOnly) 1280RegexNode.CreateOneWithCaseConversion(ch, _options, _culture, ref _caseBehavior) : 1285private RegexNode ScanDollar() 1289return RegexNode.CreateOneWithCaseConversion('$', _options, _culture, ref _caseBehavior); 1379return RegexNode.CreateOneWithCaseConversion('$', _options, _culture, ref _caseBehavior); 1412return RegexNode.CreateOneWithCaseConversion('$', _options, _culture, ref _caseBehavior); 2018_concatenation!.AddChild(RegexNode.CreateOneWithCaseConversion(_pattern[pos], isReplacement ? _options & ~RegexOptions.IgnoreCase : _options, _culture, ref _caseBehavior)); 2028_concatenation!.AddChild(RegexNode.CreateOneWithCaseConversion(c, _options, _culture, ref _caseBehavior)); 2065private void StartGroup(RegexNode openGroup)
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (25)
21public static string[]? FindPrefixes(RegexNode node, bool ignoreCase) 57static bool FindPrefixesCore(RegexNode node, List<StringBuilder> results, bool ignoreCase) 340public static string FindPrefix(RegexNode node) 348static bool Process(RegexNode node, ref ValueStringBuilder vsb) 483public static string? FindPrefixOrdinalCaseInsensitive(RegexNode node) 511public static List<RegexFindOptimizations.FixedDistanceSet>? FindFixedDistanceSets(RegexNode root, bool thorough) 586static bool TryFindRawFixedSets(RegexNode node, List<RegexFindOptimizations.FixedDistanceSet> results, ref int distance, bool thorough) 906public static string? FindFirstCharClass(RegexNode root) => FindFirstOrLastCharClass(root, findFirst: true); 911public static string? FindLastCharClass(RegexNode root) => FindFirstOrLastCharClass(root, findFirst: false); 913public static string? FindFirstOrLastCharClass(RegexNode root, bool findFirst) 942static bool? TryFindFirstOrLastCharClass(RegexNode node, bool findFirst, ref RegexCharClass? cc) 1127public static (RegexNode LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal)? FindLiteralFollowingLeadingLoop(RegexNode node) 1154RegexNode firstChild = node.Child(0); 1166RegexNode nextChild = node.Child(1); 1256public static RegexNode? FindLeadingPositiveLookahead(RegexNode node) 1258RegexNode? positiveLookahead = null; 1263static bool FindLeadingPositiveLookahead(RegexNode node, ref RegexNode? positiveLookahead) 1330public static RegexNodeKind FindLeadingAnchor(RegexNode node) => 1334public static RegexNodeKind FindTrailingAnchor(RegexNode node) => 1338private static RegexNodeKind FindLeadingOrTrailingAnchor(RegexNode node, bool leading) 1379RegexNode? child = null; 1385RegexNode tmpChild = node.Child(i);
System\Text\RegularExpressions\RegexReplacement.cs (2)
34public RegexReplacement(string rep, RegexNode concat, Hashtable _caps) 46RegexNode child = concat.Child(i);
System\Text\RegularExpressions\RegexTree.cs (4)
11/// Provides the core data describing a parsed <see cref="RegexNode"/> tree, along with necessary 18/// <summary>The root node of the parsed <see cref="RegexNode"/> tree.</summary> 19public readonly RegexNode Root; 43internal RegexTree(RegexNode root, int captureCount, string[]? captureNames, Hashtable? captureNameToNumberMapping, Hashtable? captureNumberSparseMapping, RegexOptions options, CultureInfo? culture)
System\Text\RegularExpressions\RegexTreeAnalyzer.cs (14)
9/// <summary>Analyzes a <see cref="RegexTree"/> of <see cref="RegexNode"/>s to produce data on the tree structure, in particular in support of code generation.</summary> 19static bool TryAnalyze(RegexNode node, AnalysisResults results, bool isAtomicByAncestor, bool isInLoop) 33(results._inLoops ??= new HashSet<RegexNode>()).Add(node); 52(results._mayBacktrack ??= new HashSet<RegexNode>()).Add(node); 85RegexNode child = node.Child(i); 135(results._mayBacktrack ??= new HashSet<RegexNode>()).Add(node); 158internal readonly HashSet<RegexNode> _isAtomicByAncestor = new(); // since the root is implicitly atomic, every tree will contain atomic-by-ancestor nodes 160internal readonly HashSet<RegexNode> _containsCapture = new(); // the root is a capture, so this will always contain at least the root node 162internal HashSet<RegexNode>? _mayBacktrack; 164internal HashSet<RegexNode>? _inLoops; 183public bool IsAtomicByAncestor(RegexNode node) => _isAtomicByAncestor.Contains(node); 191public bool MayContainCapture(RegexNode node) => !_complete || _containsCapture.Contains(node); 204public bool MayBacktrack(RegexNode node) => !_complete || (_mayBacktrack?.Contains(node) ?? false); 224public bool IsInLoop(RegexNode node) => !_complete || (_inLoops?.Contains(node) ?? false);
System\Text\RegularExpressions\RegexWriter.cs (2)
78RegexNode curNode = _tree.Root; 201private void EmitFragment(RegexNodeKind nodeType, RegexNode node, int curIndex)
System\Text\RegularExpressions\Symbolic\DoublyLinkedList.cs (2)
14/// <see cref="AddLast(DoublyLinkedList{T})"/> operation is made use of in the <see cref="RegexNodeConverter.ConvertToSymbolicRegexNode(RegexNode)"/> method 15/// where it maintains linear construction time in terms of the overall number of AST nodes in a given <see cref="RegexNode"/> input.
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (8)
13/// <summary>Provides functionality to convert <see cref="RegexNode"/>s to corresponding <see cref="SymbolicRegexNode{S}"/>s.</summary> 26/// <summary>Converts the root <see cref="RegexNode"/> into its corresponding <see cref="SymbolicRegexNode{S}"/>.</summary> 29internal SymbolicRegexNode<BDD> ConvertToSymbolicRegexNode(RegexNode root) 37Stack<(RegexNode Node, DoublyLinkedList<SymbolicRegexNode<BDD>> Result, DoublyLinkedList<SymbolicRegexNode<BDD>>[]? ChildResults)> stack = new(); 42while (stack.TryPop(out (RegexNode Node, DoublyLinkedList<SymbolicRegexNode<BDD>> Result, DoublyLinkedList<SymbolicRegexNode<BDD>>[]? ChildResults) popped)) 44RegexNode node = popped.Node; 191static string UnexpectedNodeType(RegexNode node) 310SymbolicRegexNode<BDD> ConvertSet(RegexNode node)