25 writes to Kind
System.Text.RegularExpressions (25)
System\Text\RegularExpressions\RegexNode.cs (25)
53Kind = kind; 59Kind = kind; 66Kind = kind; 73Kind = kind; 80Kind = kind; 152Kind += kind - RegexNodeKind.One; 172Kind += RegexNodeKind.Oneloopatomic - RegexNodeKind.Oneloop; 179Kind += RegexNodeKind.Oneloopatomic - RegexNodeKind.Onelazy; 189Kind = RegexNodeKind.Empty; 197Kind = RegexNodeKind.Multi; 208Kind = RegexNodeKind.Atomic; 228Kind = RegexNodeKind.Empty; 1018Kind = RegexNodeKind.Nothing; 1025Kind = 1035Kind = 1210prev.Kind = RegexNodeKind.Set; 1497node.Kind = RegexNodeKind.Empty; 1506node.Kind = RegexNodeKind.Empty; 1511node.Kind = RegexNodeKind.One; 1836prev.Kind = RegexNodeKind.Multi; 1981nextNode.Kind = RegexNodeKind.One; 2004currentNode.Kind = nextNode.Kind; 2126node.Kind -= RegexNodeKind.Onelazy - RegexNodeKind.Oneloop; // lazy to greedy 2290Kind = RegexNodeKind.Nothing; 3303Kind = RegexNodeKind.Multi;
323 references to Kind
System.Text.RegularExpressions (323)
System\Text\RegularExpressions\RegexCompiler.cs (71)
1274Debug.Assert(target.LoopNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic); 1457Debug.Assert(node.Kind == RegexNodeKind.Capture, "Every generated tree should begin with a capture node"); 1465switch (node.Kind) 1473int length = node.Kind == RegexNodeKind.Multi ? node.Str!.Length : 1; 1673Debug.Assert(node.Kind is RegexNodeKind.Alternate, $"Unexpected type: {node.Kind}"); 2031switch (child.Kind) 2045case RegexNodeKind.Concatenate when child.Child(0) == startingLiteralNode && (startingLiteralNode.Kind is RegexNodeKind.One or RegexNodeKind.Set or RegexNodeKind.Multi): 2055child.Child(0).Kind is RegexNodeKind.Multi ? 2095Debug.Assert(multi.Kind is RegexNodeKind.Multi, $"Expected a Multi node, got {multi.Kind}"); 2105Debug.Assert(node.Kind is RegexNodeKind.Backreference, $"Unexpected type: {node.Kind}"); 2295Debug.Assert(node.Kind is RegexNodeKind.BackreferenceConditional, $"Unexpected type: {node.Kind}"); 2309RegexNode? noBranch = node.Child(1) is { Kind: not RegexNodeKind.Empty } childNo ? childNo : null; 2454Debug.Assert(node.Kind is RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 2470RegexNode? noBranch = node.Child(2) is { Kind: not RegexNodeKind.Empty } childNo ? childNo : null; 2647Debug.Assert(node.Kind is RegexNodeKind.Capture, $"Unexpected type: {node.Kind}"); 2773Debug.Assert(node.Kind is RegexNodeKind.PositiveLookaround, $"Unexpected type: {node.Kind}"); 2817Debug.Assert(node.Kind is RegexNodeKind.NegativeLookaround, $"Unexpected type: {node.Kind}"); 2966switch (node.Kind) 3070Debug.Fail($"Unexpected node type: {node.Kind}"); 3076Debug.Assert(node.Kind is RegexNodeKind.Atomic or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround or RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 3077Debug.Assert(node.Kind is RegexNodeKind.ExpressionConditional ? node.ChildCount() >= 1 : node.ChildCount() == 1, $"Unexpected number of children: {node.ChildCount()}"); 3083if (node.Kind is RegexNodeKind.Atomic && !analysis.MayBacktrack(child)) 3120Debug.Assert(node.Kind is RegexNodeKind.UpdateBumpalong, $"Unexpected type: {node.Kind}"); 3140Debug.Assert(node.Kind is RegexNodeKind.Concatenate, $"Unexpected type: {node.Kind}"); 3198if (next.Kind is not RegexNodeKind.UpdateBumpalong) // skip node types that don't have a semantic impact 3211Debug.Assert(node.IsOneFamily || node.IsNotoneFamily || node.IsSetFamily, $"Unexpected type: {node.Kind}"); 3286Debug.Assert(node.Kind is RegexNodeKind.Boundary or RegexNodeKind.NonBoundary or RegexNodeKind.ECMABoundary or RegexNodeKind.NonECMABoundary, $"Unexpected type: {node.Kind}"); 3302switch (node.Kind) 3318if (node.Kind is RegexNodeKind.Boundary) 3331if (node.Kind is RegexNodeKind.ECMABoundary) 3346Debug.Assert(node.Kind is RegexNodeKind.Beginning or RegexNodeKind.Start or RegexNodeKind.Bol or RegexNodeKind.End or RegexNodeKind.EndZ or RegexNodeKind.Eol, $"Unexpected type: {node.Kind}"); 3351switch (node.Kind) 3365if (node.Kind == RegexNodeKind.Beginning) 3484Debug.Assert(node.Kind is RegexNodeKind.Multi, $"Unexpected type: {node.Kind}"); 3536Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop, $"Unexpected type: {node.Kind}"); 3673switch (literal.Kind) 3811Debug.Assert(node.Kind is RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy, $"Unexpected type: {node.Kind}"); 3912node.Kind is RegexNodeKind.Notonelazy && 4053node.Kind is RegexNodeKind.Setlazy && 4158Debug.Assert(node.Kind is RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 4520Debug.Assert(node.IsOneFamily || node.IsNotoneFamily || node.IsSetFamily, $"Unexpected type: {node.Kind}"); 4670Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic, $"Unexpected type: {node.Kind}"); 4917Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic, $"Unexpected type: {node.Kind}"); 5006Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 5010Debug.Assert(!analysis.MayBacktrack(node.Child(0)), $"Expected non-backtracking node {node.Kind}"); 5044Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 5442if (node.Kind == RegexNodeKind.Multi) 5475if (node.Kind == RegexNodeKind.Multi) 5668if (root.Kind is RegexNodeKind.Multi or RegexNodeKind.One or RegexNodeKind.Notone or RegexNodeKind.Set) 5686Ldc((root.Kind == RegexNodeKind.Multi ? root.Str!.Length : 1) * (!rtl ? 1 : -1));
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
822Debug.Assert(loopNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic);
System\Text\RegularExpressions\RegexNode.cs (190)
89Debug.Assert(Kind is RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or 95new RegexNode(Kind, Options, Str!) : 96new RegexNode(Kind, Options, Ch); 138Kind == RegexNodeKind.Concatenate && 167switch (Kind) 193else if (Kind == RegexNodeKind.Oneloopatomic && N is >= 2 and <= MultiVsRepeaterLimit) 205if (Parent is not { Kind: RegexNodeKind.Atomic }) 233Debug.Fail($"Unexpected type: {Kind}"); 243Debug.Assert(Kind == RegexNodeKind.Capture, "Every generated tree should begin with a capture node"); 262Debug.Assert(Kind != RegexNodeKind.Group, "All Group nodes should have been removed."); 265switch (node.Kind) 298Debug.Assert(childCount == 0, $"Expected zero children for {node.Kind}, got {childCount}."); 307Debug.Assert(childCount == 1, $"Expected one and only one child for {node.Kind}, got {childCount}."); 311Debug.Assert(childCount == 2, $"Expected two children for {node.Kind}, got {childCount}"); 315Debug.Assert(childCount == 3, $"Expected three children for {node.Kind}, got {childCount}"); 320Debug.Assert(childCount >= 2, $"Expected at least two children for {node.Kind}, got {childCount}."); 324Debug.Fail($"Unexpected node type: {node.Kind}"); 329switch (node.Kind) 340Debug.Assert(!string.IsNullOrEmpty(node.Str), $"Expected non-null, non-empty string for {node.Kind}."); 344Debug.Assert(node.Str is null, $"Expected null string for {node.Kind}, got \"{node.Str}\"."); 349switch (node.Kind) 355Debug.Assert((node.Options & RegexOptions.IgnoreCase) == 0, $"{node.Kind} node should not have RegexOptions.IgnoreCase"); 372Debug.Assert(rootNode.Kind == RegexNodeKind.Capture); 427switch (node.Kind) 440if (node.Parent is { Kind: RegexNodeKind.Concatenate } parent) 518switch (node.Kind) 545if ((existingChild.Kind is RegexNodeKind.Alternate or RegexNodeKind.BackreferenceConditional or RegexNodeKind.ExpressionConditional or RegexNodeKind.Loop or RegexNodeKind.Lazyloop) && 546node.Parent is not { Kind: RegexNodeKind.Atomic }) // validate grandparent isn't atomic 568if (node.Kind != RegexNodeKind.ExpressionConditional) // ReduceExpressionConditional will have already applied ending backtracking removal 589Debug.Assert(node.Kind is RegexNodeKind.Atomic or RegexNodeKind.Empty or RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 591if (node.Kind is RegexNodeKind.Atomic) 594Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 597if (node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop) 624switch (Kind) 636return Kind switch 659Debug.Assert(Kind is RegexNodeKind.Alternate or RegexNodeKind.Concatenate); 6620 => new RegexNode(Kind == RegexNodeKind.Alternate ? RegexNodeKind.Nothing : RegexNodeKind.Empty, Options), 676Debug.Assert(Kind == RegexNodeKind.Group); 679while (u.Kind == RegexNodeKind.Group) 704Debug.Assert(Kind == RegexNodeKind.Atomic); 709while (child.Kind == RegexNodeKind.Atomic) 715switch (child.Kind) 759if (branches[0].Kind == RegexNodeKind.Empty) 770if (branches[i].Kind == RegexNodeKind.Empty) 851(child.Child(0).Kind is RegexNodeKind.Empty || child.Child(1).Kind is RegexNodeKind.Empty); // can be transformed into a ? or ?? 866return child.Kind == RegexNodeKind.Empty ? 881Debug.Assert(Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 884RegexNodeKind kind = Kind; 894if (child.Kind != kind) 899switch (child.Kind) 913switch (child.Kind) 960switch (child.Kind) 965child.MakeRep(u.Kind == RegexNodeKind.Lazyloop ? RegexNodeKind.Onelazy : RegexNodeKind.Oneloop, u.M, u.N); 1013Debug.Assert(Kind is RegexNodeKind.Set or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy); 1026Kind == RegexNodeKind.Set ? RegexNodeKind.One : 1027Kind == RegexNodeKind.Setloop ? RegexNodeKind.Oneloop : 1028Kind == RegexNodeKind.Setloopatomic ? RegexNodeKind.Oneloopatomic : 1036Kind == RegexNodeKind.Set ? RegexNodeKind.Notone : 1037Kind == RegexNodeKind.Setloop ? RegexNodeKind.Notoneloop : 1038Kind == RegexNodeKind.Setloopatomic ? RegexNodeKind.Notoneloopatomic : 1073Debug.Assert(Kind == RegexNodeKind.Alternate); 1086if (node.Kind == RegexNodeKind.Alternate) 1089if (node.Kind == RegexNodeKind.Alternate) 1092if (node.Kind == RegexNodeKind.Alternate) 1100if (node.Kind is RegexNodeKind.Alternate && node.ChildCount() == 2) 1102if (node.Child(1).Kind is RegexNodeKind.Empty) 1106else if (node.Child(0).Kind is RegexNodeKind.Empty) 1143if (at.Kind == RegexNodeKind.Alternate) 1161else if (at.Kind is RegexNodeKind.Set or RegexNodeKind.One) 1166if (at.Kind == RegexNodeKind.Set) 1190if (prev.Kind == RegexNodeKind.One) 1200if (at.Kind == RegexNodeKind.One) 1217else if (at.Kind == RegexNodeKind.Nothing) 1241Debug.Assert(alternation.Kind == RegexNodeKind.Alternate); 1260RegexNode required = startingNode.Kind == RegexNodeKind.Concatenate ? startingNode.Child(0) : startingNode; 1261switch (required.Kind) 1281RegexNode other = endingNode.Kind == RegexNodeKind.Concatenate ? endingNode.Child(0) : endingNode; 1282if (required.Kind != other.Kind || 1303if (children[i].Kind == RegexNodeKind.Concatenate) 1316if (alternation.Parent is RegexNode { Kind: RegexNodeKind.Atomic }) 1341Debug.Assert(node.Kind == RegexNodeKind.Alternate); 1350switch (child.Kind) 1384Debug.Assert(alternation.Kind == RegexNodeKind.Alternate); 1414if (startingNode.Kind == RegexNodeKind.One) 1434if (startingNode.Kind == RegexNodeKind.One) 1448Debug.Assert(startingNode.Kind == RegexNodeKind.Multi); 1485ProcessOneOrMulti(branch.Kind == RegexNodeKind.Concatenate ? branch.Child(0) : branch, startingSpan); 1493if (node.Kind == RegexNodeKind.One) 1502Debug.Assert(node.Kind == RegexNodeKind.Multi); 1523if (alternation.Parent is RegexNode parent && parent.Kind == RegexNodeKind.Atomic) 1550RegexNode branch = Kind == RegexNodeKind.Concatenate ? Child(0) : this; 1551return branch.Kind is RegexNodeKind.One or RegexNodeKind.Multi ? branch : null; 1557Debug.Assert(Kind is RegexNodeKind.One or RegexNodeKind.Multi || (IsOneFamily && M > 0)); 1572Debug.Assert(Kind is RegexNodeKind.Alternate); 1596if (startingLiteralNode.IsOneFamily || startingLiteralNode.Kind is RegexNodeKind.Multi) 1640switch (node.Kind) 1675switch (node.Kind) 1742Debug.Assert(Kind == RegexNodeKind.Concatenate); 1758if (child.Kind == RegexNodeKind.Nothing) 1784Debug.Assert(Kind == RegexNodeKind.Concatenate); 1801if (at.Kind == RegexNodeKind.Concatenate && 1820else if (at.Kind is RegexNodeKind.Multi or RegexNodeKind.One) 1834if (prev.Kind == RegexNodeKind.One) 1841((at.Kind == RegexNodeKind.One) ? $"{prev.Str}{at.Ch}" : prev.Str + at.Str) : 1842((at.Kind == RegexNodeKind.One) ? $"{at.Ch}{prev.Str}" : at.Str + prev.Str); 1844else if (at.Kind == RegexNodeKind.Empty) 1867Debug.Assert(Kind == RegexNodeKind.Concatenate); 1902switch (currentNode.Kind) 1905case RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Onelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Notonelazy when nextNode.Kind == currentNode.Kind && currentNode.Ch == nextNode.Ch: 1906case RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy when nextNode.Kind == currentNode.Kind && currentNode.Str == nextNode.Str: 1908currentNode.Kind is RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloopatomic) 1931case RegexNodeKind.Oneloop or RegexNodeKind.Onelazy when nextNode.Kind == RegexNodeKind.One && currentNode.Ch == nextNode.Ch: 1932case RegexNodeKind.Notoneloop or RegexNodeKind.Notonelazy when nextNode.Kind == RegexNodeKind.Notone && currentNode.Ch == nextNode.Ch: 1933case RegexNodeKind.Setloop or RegexNodeKind.Setlazy when nextNode.Kind == RegexNodeKind.Set && currentNode.Str == nextNode.Str: 1948nextNode.Kind == RegexNodeKind.Multi && 1999case RegexNodeKind.One when (nextNode.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Onelazy) && currentNode.Ch == nextNode.Ch: 2000case RegexNodeKind.Notone when (nextNode.Kind is RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Notonelazy) && currentNode.Ch == nextNode.Ch: 2001case RegexNodeKind.Set when (nextNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy) && currentNode.Str == nextNode.Str: 2004currentNode.Kind = nextNode.Kind; 2014case RegexNodeKind.Notone when nextNode.Kind == currentNode.Kind && currentNode.Ch == nextNode.Ch: 2015case RegexNodeKind.Set when nextNode.Kind == RegexNodeKind.Set && currentNode.Str == nextNode.Str: 2026when nextNode.Kind == currentNode.Kind: 2069if (Kind is not RegexNodeKind.Concatenate) 2093while (node.Kind is RegexNodeKind.Capture or RegexNodeKind.Concatenate) 2099switch (node.Kind) 2145while (loopChild.Kind is RegexNodeKind.Capture or RegexNodeKind.Concatenate) 2156if (loopChild.Kind is 2164else if (node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop) 2207for (int b = node.Kind == RegexNodeKind.ExpressionConditional ? 1 : 0; b < alternateBranches; b++) 2221Debug.Assert(Kind is RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround); 2229if (Kind is RegexNodeKind.NegativeLookaround && ContainsKind(Child(0), [RegexNodeKind.Backreference, RegexNodeKind.BackreferenceConditional]) is false) 2244if (node is { Kind: RegexNodeKind.Capture, N: -1 }) 2275if (Kind is RegexNodeKind.PositiveLookaround) 2277if (((Options & RegexOptions.RightToLeft) == 0 && IsZeroWidthAssertion(child.Kind)) || 2278child.Kind is RegexNodeKind.Empty) 2283else if (Kind is RegexNodeKind.NegativeLookaround) 2288if (child.Kind is RegexNodeKind.Empty) 2313if (node.Kind == kind) 2341Debug.Assert(Kind == RegexNodeKind.BackreferenceConditional); 2359Debug.Assert(Kind == RegexNodeKind.ExpressionConditional); 2377if (condition.Kind == RegexNodeKind.PositiveLookaround && (condition.Options & RegexOptions.RightToLeft) == 0) 2402Debug.Assert(loopNode.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop); 2411switch (literal.Kind) 2414case RegexNodeKind.Set when loopNode.Kind is RegexNodeKind.Setloop && RegexCharClass.IsSubsetOf(literal.Str!, loopNode.Str!): // e.g. \d+[0-9]\s 2436static bool CharInLoopSet(RegexNode loopNode, char ch) => loopNode.Kind switch 2462while (node.Kind is RegexNodeKind.Capture or RegexNodeKind.Concatenate) 2476switch (subsequent.Kind) 2516switch (subsequent.Kind) 2532switch (node.Kind) 2536switch (subsequent.Kind) 2566switch (subsequent.Kind) 2585switch (subsequent.Kind) 2632switch (subsequent.Kind) 2701switch (parent?.Kind) 2738public bool IsBacktrackingConstruct => Kind switch 2788Debug.Assert(node.Kind is not RegexNodeKind.Concatenate, "The existing logic assumes that the node itself isn't a concatenation."); 2799switch (parent.Kind) 2841switch (Kind) 2936Debug.Fail($"Unknown node: {Kind}"); 2954switch (Kind) 3014int i = Kind == RegexNodeKind.BackreferenceConditional ? 0 : 1; 3073Debug.Fail($"Unknown node: {Kind}"); 3105Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}"); 3127while (child.Kind is RegexNodeKind.Capture or RegexNodeKind.Atomic) 3133if (child.Kind is RegexNodeKind.One) 3146else if (child.Kind is RegexNodeKind.Multi) 3158else if (child.Kind is RegexNodeKind.Set || 3159(child.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic && child.M == child.N)) 3168vsb.Append((char)(twoChars[0] | 0x20), child.Kind is RegexNodeKind.Set ? 1 : child.M); 3170else if (child.Kind is RegexNodeKind.Concatenate) 3190else if (child.Kind is RegexNodeKind.Empty) 3195else if (consumeZeroWidthNodes && IsZeroWidthAssertion(child.Kind)) 3241Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}"); 3243static bool CanJoinLengthCheck(RegexNode node) => node.Kind switch 3297case <= MultiVsRepeaterLimit when Kind == RegexNodeKind.One: 3310switch (Kind) 3450public bool IsSetFamily => Kind is RegexNodeKind.Set or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy; 3453public bool IsOneFamily => Kind is RegexNodeKind.One or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Onelazy; 3456public bool IsNotoneFamily => Kind is RegexNodeKind.Notone or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Notonelazy; 3495var sb = new StringBuilder(Kind.ToString()); 3505switch (Kind) 3544switch (Kind)
System\Text\RegularExpressions\RegexParser.cs (6)
1075if (_group!.Kind != RegexNodeKind.ExpressionConditional || _group.ChildCount() > 0) 1217if (result != null && result.Kind == RegexNodeKind.Backreference && (result.Options & RegexOptions.IgnoreCase) != 0) 2228if (_group.Kind == RegexNodeKind.ExpressionConditional && _group.ChildCount() == 0) 2253if (_group!.Kind is RegexNodeKind.ExpressionConditional or RegexNodeKind.BackreferenceConditional) 2268if (_group!.Kind is RegexNodeKind.ExpressionConditional or RegexNodeKind.BackreferenceConditional) 2272if (_group.Kind == RegexNodeKind.BackreferenceConditional && _group.ChildCount() > 2 || _group.ChildCount() > 3)
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (27)
80switch (node.Kind) 114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength); 119return node.Kind is RegexNodeKind.One || reps == node.N; 164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength); 209return node.Kind is RegexNodeKind.Set || reps == node.N; 360switch (node.Kind) 489switch (node.Kind) 598switch (node.Kind) 950switch (node.Kind) 959return node.Kind is RegexNodeKind.One || node.M > 0 ? true : null; 977return node.Kind is RegexNodeKind.Notone || node.M > 0 ? true : null; 996node.Kind is RegexNodeKind.Set || node.M > 0 ? true : 1104int branchStart = node.Kind is RegexNodeKind.BackreferenceConditional ? 0 : 1; 1118Debug.Fail($"Unexpected node {node.Kind}"); 1138while (node.Kind is RegexNodeKind.Atomic or RegexNodeKind.Capture) 1142if (node.Kind != RegexNodeKind.Concatenate) 1155while (firstChild.Kind is RegexNodeKind.Atomic or RegexNodeKind.Capture) 1159if (firstChild.Kind is not (RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy) || firstChild.N != int.MaxValue) 1167if (nextChild.Kind == RegexNodeKind.UpdateBumpalong) 1224while ((nextChild.Kind is RegexNodeKind.Atomic or RegexNodeKind.Capture or RegexNodeKind.Concatenate) || 1225(nextChild.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop && nextChild.M >= 1)) 1233(nextChild.Kind is RegexNodeKind.Set || nextChild.M >= 1)) 1277switch (node.Kind) 1349switch (node.Kind) 1358return node.Kind; 1386switch (tmpChild.Kind) 1416if (node.Child(i).Kind is not (RegexNodeKind.Empty or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround))
System\Text\RegularExpressions\RegexReplacement.cs (4)
36Debug.Assert(concat.Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {concat.Kind}"); 48switch (child.Kind) 77Debug.Fail($"Unexpected child kind {child.Kind}");
System\Text\RegularExpressions\RegexTreeAnalyzer.cs (2)
55switch (node.Kind) 86bool treatChildAsAtomic = (isAtomicByAncestor | isAtomicBySelf) && node.Kind switch
System\Text\RegularExpressions\RegexWriter.cs (11)
85EmitFragment(curNode.Kind, curNode, 0); 89EmitFragment(curNode.Kind | BeforeChild, curNode, curChild); 105EmitFragment(curNode.Kind | AfterChild, curNode, curChild); 383Emit((RegexOpcode)node.Kind | bits, node.Ch); 394Emit(((node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Onelazy) ? 399Emit((RegexOpcode)node.Kind | bits, node.Ch, node.N == int.MaxValue ? int.MaxValue : node.N - node.M); 414Emit((RegexOpcode)node.Kind | bits, stringCode, (node.N == int.MaxValue) ? int.MaxValue : node.N - node.M); 420Emit((RegexOpcode)node.Kind | bits, StringCode(node.Str!)); 424Emit((RegexOpcode)node.Kind | bits, StringCode(node.Str!)); 428Emit((RegexOpcode)node.Kind | bits, RegexParser.MapCaptureNumber(node.M, _tree.CaptureNumberSparseMapping)); 443Emit((RegexOpcode)node.Kind);
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (11)
53switch (node.Kind) 117result.AddLast(_builder.CreateLoop(_builder.CreateSingleton(bdd), node.Kind is RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy, node.M, node.N)); 128result.AddLast(_builder.CreateLoop(_builder.CreateSingleton(setBdd), node.Kind == RegexNodeKind.Setlazy, node.M, node.N)); 178throw new NotSupportedException(SR.Format(SR.NotSupported_NonBacktrackingConflictingExpression, node.Kind switch 195string description = $"Unexpected ({nameof(RegexNodeKind)}: {node.Kind})"; 209switch (node.Kind) 260result.AddLast(_builder.CreateLoop(body, node.Kind == RegexNodeKind.Lazyloop, node.M, node.N)); 267Debug.Assert(node.Kind == RegexNodeKind.Capture && node.N == -1); 285Debug.Assert(rootResult.Count == 1 || root.Kind == RegexNodeKind.Concatenate || root.Kind == RegexNodeKind.Capture); 312Debug.Assert(node.Kind == RegexNodeKind.Set);