12 writes to N
System.Text.RegularExpressions.Generator (12)
src\libraries\System.Text.RegularExpressions\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; 890u.N = max = ((int.MaxValue - 1) / u.N < max) ? int.MaxValue : u.N * max; 1867currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N; 1881currentNode.N++; 1908currentNode.N += matchingCharsInMulti; 1948currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1;
108 references to N
System.Text.RegularExpressions.Generator (108)
RegexGenerator.Emitter.cs (34)
1503Debug.Assert(target.LoopNode.N == int.MaxValue); 2629int uncapnum = RegexParser.MapCaptureNumber(node.N, rm.Tree.CaptureNumberSparseMapping); 3126child.M == child.N && 3409if (node.M == node.N) 3419Debug.Assert(node.M < node.N); 3481node.N > 1 && // no point in using IndexOf for small loops, in particular optionals 3549if (node.M == node.N || rm.Analysis.IsAtomicByAncestor(node)) 3560Debug.Assert(node.M < node.N); 3571if (node.N != int.MaxValue) 3573maxIterations = $"{node.N - node.M}"; 3786Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 3791int maxIterations = node.N; 4207if (node.M == node.N) 4214if (node.M == 0 && node.N == 1) 4220Debug.Assert(node.N > node.M); 4222int maxIterations = node.N; 4337Debug.Assert(node.M == 0 && node.N == 1); 4376Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 4396Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4401int maxIterations = node.N; 5546RegexNodeKind.Capture when node.M == -1 && node.N != -1 => $"Non-capturing balancing group. Uncaptures the {DescribeCapture(node.N, rm)}.", 5547RegexNodeKind.Capture when node.N != -1 => $"Balancing group. Captures the {DescribeCapture(node.M, rm)} and uncaptures the {DescribeCapture(node.N, rm)}.", 5548RegexNodeKind.Capture when node.N == -1 => $"{DescribeCapture(node.M, rm)}.", 5555RegexNodeKind.Loop or RegexNodeKind.Lazyloop => node.M == 0 && node.N == 1 ? $"Optional ({(node.Kind is RegexNodeKind.Loop ? "greedy" : "lazy")})." : $"Loop {DescribeLoop(node, rm)}{direction}.", 5783_ when node.M == node.N => "exactly", 5791node.M == node.N ? $" {node.M} times" : 5792(node.M, node.N) switch 5799(0, _) => $" at most {node.N} times", 5800_ => $" at least {node.M} and at most {node.N} times"
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (52)
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) 424case RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when node.N == int.MaxValue: 425case RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when node.N == int.MaxValue && !atomicByAncestry: 552if (node.N == 1 || CanBeMadeAtomic(node.Child(0), node.Child(0), iterateNullableSubsequent: false, allowLazy: false)) 832int max = N; 876if (u.M == 0 && child.M > 1 || child.N < child.M * 2) 888if (u.N > 0) 890u.N = max = ((int.MaxValue - 1) / u.N < max) ? int.MaxValue : u.N * max; 910child.MakeRep(u.Kind == RegexNodeKind.Lazyloop ? RegexNodeKind.Onelazy : RegexNodeKind.Oneloop, u.M, u.N); 1210case RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop or RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when required.M == required.N: 1230required.N != other.N || 1859if (!CanCombineCounts(currentNode.M, currentNode.N, nextNode.M, nextNode.N)) 1865if (currentNode.N != int.MaxValue) 1867currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N; 1876if (CanCombineCounts(currentNode.M, currentNode.N, 1, 1)) 1879if (currentNode.N != int.MaxValue) 1902if (CanCombineCounts(currentNode.M, currentNode.N, matchingCharsInMulti, matchingCharsInMulti)) 1906if (currentNode.N != int.MaxValue) 1944if (CanCombineCounts(1, 1, nextNode.M, nextNode.N)) 1948currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1; 2121if (node.N == 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: false)) 2131if (node.N == 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: true)) 2186if (node is { Kind: RegexNodeKind.Capture, N: -1 }) 2505(node.N > 1 && RegexCharClass.MayOverlap(loopStartingSet, loopEndingSet))) 2604RegexNodeKind.Loop or RegexNodeKind.Lazyloop when M != N => true, 2607RegexNodeKind.Setloop or RegexNodeKind.Setlazy when M != N => true, 2833return N == int.MaxValue ? null : N; 2836if (N != int.MaxValue) 2841long maxLength = (long)N * childMaxLength; 2999(child.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic && child.M == child.N)) 3070when node.M == node.N => true, 3331if (N != -1) 3333sb.Append($", unindex = {N}"); 3370(M == 0 && N == int.MaxValue) ? "*" : 3371(M == 0 && N == 1) ? "?" : 3372(M == 1 && N == int.MaxValue) ? "+" : 3373(N == int.MaxValue) ? $"{{{M}, *}}" : 3374(N == M) ? $"{{{M}}}" : 3375$"{{{M}, {N}}}");
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNodeKind.cs (12)
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"/>. 129/// and the maximum number of iterations is in <see cref="RegexNode.N"/>. 135/// and the maximum number of iterations is in <see cref="RegexNode.N"/>. 142/// group, <see cref="RegexNode.N"/> is the uncapture.
src\libraries\System.Text.RegularExpressions\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)
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexTreeAnalyzer.cs (1)
107RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.N == 1 => true,