12 writes to N
System.Text.RegularExpressions.Generator (12)
parent\src\System\Text\RegularExpressions\RegexNode.cs (12)
83N = n; 99newNode.N = N == int.MaxValue ? int.MaxValue : N - 1; 154N = max; 182N = M; 200M = N = 0; 209M = N = 0; 218N = M; 945u.N = max = ((int.MaxValue - 1) / u.N < max) ? int.MaxValue : u.N * max; 1925currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N; 1939currentNode.N++; 1966currentNode.N += matchingCharsInMulti; 2006currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1;
88 references to N
System.Text.RegularExpressions.Generator (88)
parent\src\System\Text\RegularExpressions\RegexNode.cs (44)
99newNode.N = N == int.MaxValue ? int.MaxValue : N - 1; 185if (N == 0) 193else if (Kind == RegexNodeKind.Oneloopatomic && N is >= 2 and <= MultiVsRepeaterLimit) 198Str = new string(Ch, N); 207RegexNode loopAsChild = new(RegexNodeKind.Loop, Options, M, N); 221if (N != 0) 438case RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when node.N == int.MaxValue: 439case RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when node.N == int.MaxValue && !atomicByAncestry: 599if (node.N == 1 || CanBeMadeAtomic(node.Child(0), node.Child(0), iterateNullableSubsequent: false, allowLazy: false)) 887int max = N; 931if (u.M == 0 && child.M > 1 || child.N < child.M * 2) 943if (u.N > 0) 945u.N = max = ((int.MaxValue - 1) / u.N < max) ? int.MaxValue : u.N * max; 965child.MakeRep(u.Kind == RegexNodeKind.Lazyloop ? RegexNodeKind.Onelazy : RegexNodeKind.Oneloop, u.M, u.N); 1265case RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop or RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when required.M == required.N: 1285required.N != other.N || 1917if (!CanCombineCounts(currentNode.M, currentNode.N, nextNode.M, nextNode.N)) 1923if (currentNode.N != int.MaxValue) 1925currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N; 1934if (CanCombineCounts(currentNode.M, currentNode.N, 1, 1)) 1937if (currentNode.N != int.MaxValue) 1960if (CanCombineCounts(currentNode.M, currentNode.N, matchingCharsInMulti, matchingCharsInMulti)) 1964if (currentNode.N != int.MaxValue) 2002if (CanCombineCounts(1, 1, nextNode.M, nextNode.N)) 2006currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1; 2179if (node.N == 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: false)) 2189if (node.N == 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: true)) 2244if (node is { Kind: RegexNodeKind.Capture, N: -1 }) 2621(node.N > 1 && RegexCharClass.MayOverlap(loopStartingSet, loopEndingSet))) 2741RegexNodeKind.Loop or RegexNodeKind.Lazyloop when M != N => true, 2744RegexNodeKind.Setloop or RegexNodeKind.Setlazy when M != N => true, 2970return N == int.MaxValue ? null : N; 2973if (N != int.MaxValue) 2978long maxLength = (long)N * childMaxLength; 3159(child.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic && child.M == child.N)) 3250when node.M == node.N => true,
parent\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (9)
119return node.Kind is RegexNodeKind.One || reps == node.N; 209return node.Kind is RegexNodeKind.Set || reps == node.N; 236return limit == node.N; 436return count == node.N && !rtl; 450return limit == node.N && !rtl; 618return i == node.M && i == node.N; 649return i == node.M && i == node.N; 658case RegexNodeKind.Notonelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic when node.M == node.N: 1159if (firstChild.Kind is not (RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy) || firstChild.N != int.MaxValue)
parent\src\System\Text\RegularExpressions\RegexTreeAnalyzer.cs (1)
107RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.N == 1 => true,
RegexGenerator.Emitter.cs (34)
1504Debug.Assert(target.LoopNode.N == int.MaxValue); 2631int uncapnum = RegexParser.MapCaptureNumber(node.N, rm.Tree.CaptureNumberSparseMapping); 3128child.M == child.N && 3411if (node.M == node.N) 3421Debug.Assert(node.M < node.N); 3483node.N > 1 && // no point in using IndexOf for small loops, in particular optionals 3591if (node.M == node.N || rm.Analysis.IsAtomicByAncestor(node)) 3602Debug.Assert(node.M < node.N); 3613if (node.N != int.MaxValue) 3615maxIterations = $"{node.N - node.M}"; 3828Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 3833int maxIterations = node.N; 4255if (node.M == node.N) 4262if (node.M == 0 && node.N == 1) 4268Debug.Assert(node.N > node.M); 4270int maxIterations = node.N; 4385Debug.Assert(node.M == 0 && node.N == 1); 4424Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 4444Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4449int maxIterations = node.N; 5594RegexNodeKind.Capture when node.M == -1 && node.N != -1 => $"Non-capturing balancing group. Uncaptures the {DescribeCapture(node.N, rm)}.", 5595RegexNodeKind.Capture when node.N != -1 => $"Balancing group. Captures the {DescribeCapture(node.M, rm)} and uncaptures the {DescribeCapture(node.N, rm)}.", 5596RegexNodeKind.Capture when node.N == -1 => $"{DescribeCapture(node.M, rm)}.", 5603RegexNodeKind.Loop or RegexNodeKind.Lazyloop => node.M == 0 && node.N == 1 ? $"Optional ({(node.Kind is RegexNodeKind.Loop ? "greedy" : "lazy")})." : $"Loop {DescribeLoop(node, rm)}{direction}.", 5831_ when node.M == node.N => "exactly", 5839node.M == node.N ? $" {node.M} times" : 5840(node.M, node.N) switch 5847(0, _) => $" at most {node.N} times", 5848_ => $" at least {node.M} and at most {node.N} times"