12 writes to N
System.Text.RegularExpressions (12)
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; 1805currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N; 1819currentNode.N++; 1846currentNode.N += matchingCharsInMulti; 1886currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1;
112 references to N
System.Text.RegularExpressions (112)
System\Text\RegularExpressions\RegexCompiler.cs (22)
1250Debug.Assert(target.LoopNode.N == int.MaxValue); 2391int uncapnum = RegexParser.MapCaptureNumber(node.N, _regexTree.CaptureNumberSparseMapping); 3297if (node.M == node.N) 3307Debug.Assert(node.M < node.N); 3405node.N > 1 && 3515if (node.M == node.N || analysis.IsAtomicByAncestor(node)) 3520Debug.Assert(node.M < node.N); 3532if (node.N != int.MaxValue) 3534maxIterations = node.N - node.M; 3852Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 3857int maxIterations = node.N; 4364if (node.M == node.N) 4371if (node.M == 0 && node.N == 1) 4377Debug.Assert(node.N > node.M); 4379int maxIterations = node.N; 4609Debug.Assert(node.M == 0 && node.N == 1); 4699Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 4737Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4742int maxIterations = node.N;
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
823Debug.Assert(loopNode.N == int.MaxValue);
System\Text\RegularExpressions\RegexNode.cs (49)
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); 1227case RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop or RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when required.M == required.N: 1246required.N != other.N || 1797if (!CanCombineCounts(currentNode.M, currentNode.N, nextNode.M, nextNode.N)) 1803if (currentNode.N != int.MaxValue) 1805currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N; 1814if (CanCombineCounts(currentNode.M, currentNode.N, 1, 1)) 1817if (currentNode.N != int.MaxValue) 1840if (CanCombineCounts(currentNode.M, currentNode.N, matchingCharsInMulti, matchingCharsInMulti)) 1844if (currentNode.N != int.MaxValue) 1882if (CanCombineCounts(1, 1, nextNode.M, nextNode.N)) 1886currentNode.N = nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1; 2053if (node.N == 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: false)) 2063if (node.N == 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: true)) 2433(node.N > 1 && RegexCharClass.MayOverlap(loopStartingSet, loopEndingSet))) 2715return N == int.MaxValue ? null : N; 2718if (N != int.MaxValue) 2723long maxLength = (long)N * childMaxLength; 2881(child.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic && child.M == child.N)) 2952when node.M == node.N => true, 3213if (N != -1) 3215sb.Append($", unindex = {N}"); 3252(M == 0 && N == int.MaxValue) ? "*" : 3253(M == 0 && N == 1) ? "?" : 3254(M == 1 && N == int.MaxValue) ? "+" : 3255(N == int.MaxValue) ? $"{{{M}, *}}" : 3256(N == M) ? $"{{{M}}}" : 3257$"{{{M}, {N}}}");
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.
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)
System\Text\RegularExpressions\RegexTreeAnalyzer.cs (3)
50case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.M != node.N: 51case RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop or RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when node.M != node.N: 111RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.N == 1 => true,
System\Text\RegularExpressions\RegexWriter.cs (11)
314if (node.N < int.MaxValue || node.M > 1) 333if (node.N < int.MaxValue || node.M > 1) 334Emit(RegexOpcode.Branchcount + Lazy, _intStack.Pop(), node.N == int.MaxValue ? int.MaxValue : node.N - node.M); 348Emit(RegexOpcode.Capturemark, RegexParser.MapCaptureNumber(node.M, _tree.CaptureNumberSparseMapping), RegexParser.MapCaptureNumber(node.N, _tree.CaptureNumberSparseMapping)); 397if (node.N > node.M) 399Emit((RegexOpcode)node.Kind | bits, node.Ch, node.N == int.MaxValue ? int.MaxValue : node.N - node.M); 412if (node.N > node.M) 414Emit((RegexOpcode)node.Kind | bits, stringCode, (node.N == int.MaxValue) ? int.MaxValue : node.N - node.M);
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (5)
88case RegexNodeKind.Capture when node.N == -1: // N == -1 because balancing groups (which have N >= 0) aren't supported 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)); 260result.AddLast(_builder.CreateLoop(body, node.Kind == RegexNodeKind.Lazyloop, node.M, node.N)); 267Debug.Assert(node.Kind == RegexNodeKind.Capture && node.N == -1);