11 writes to M
System.Text.RegularExpressions (11)
System\Text\RegularExpressions\RegexNode.cs (11)
75M = m; 82M = m; 98newNode.M = M - 1; 153M = min; 200M = N = 0; 209M = N = 0; 940u.M = min = ((int.MaxValue - 1) / u.M < min) ? int.MaxValue : u.M * min; 1922currentNode.M += nextNode.M; 1936currentNode.M++; 1963currentNode.M += matchingCharsInMulti; 2005currentNode.M = nextNode.M + 1;
177 references to M
System.Text.RegularExpressions (177)
System\Text\RegularExpressions\RegexCompiler.cs (35)
1368if (target.LoopNode.M > 0) 1383Ldc(target.LoopNode.M); 2107int capnum = RegexParser.MapCaptureNumber(node.M, _regexTree!.CaptureNumberSparseMapping); 2304int capnum = RegexParser.MapCaptureNumber(node.M, _regexTree!.CaptureNumberSparseMapping); 2650int capnum = RegexParser.MapCaptureNumber(node.M, _regexTree!.CaptureNumberSparseMapping); 3546if (node.M == node.N) 3556Debug.Assert(node.M < node.N); 3586if (node.M > 0) 3589Ldc(!rtl ? node.M : -node.M); 3816if (node.M > 0) 3823if (node.M == node.N || analysis.IsAtomicByAncestor(node)) 3828Debug.Assert(node.M < node.N); 3842maxIterations = node.N - node.M; 4159Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 4160Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4164int minIterations = node.M; 4522int iterations = node.M; 4673if (node.M == node.N) 4680if (node.M == 0 && node.N == 1) 4686Debug.Assert(node.N > node.M); 4687int minIterations = node.M; 4918Debug.Assert(node.M == 0 && node.N == 1); 5007Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 5008Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 5038Ldc(node.M); 5045Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 5046Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 5050int minIterations = node.M;
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
845if ((i - prev - 1) < loopNode.M)
System\Text\RegularExpressions\RegexNode.cs (75)
92Debug.Assert(M > 0); 98newNode.M = M - 1; 182N = M; 207RegexNode loopAsChild = new(RegexNodeKind.Loop, Options, M, N); 218N = M; 886int min = M; 931if (u.M == 0 && child.M > 1 || child.N < child.M * 2) 938if (u.M > 0) 940u.M = min = ((int.MaxValue - 1) / u.M < min) ? int.MaxValue : u.M * min; 965child.MakeRep(u.Kind == RegexNodeKind.Lazyloop ? RegexNodeKind.Onelazy : RegexNodeKind.Oneloop, u.M, u.N); 990u = u.M == 0 ? new RegexNode(RegexNodeKind.Empty, Options) : child; 1265case RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop or RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when required.M == required.N: 1284required.M != other.M || 1557Debug.Assert(Kind is RegexNodeKind.One or RegexNodeKind.Multi || (IsOneFamily && M > 0)); 1643case RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Onelazy when node.M > 0: 1645case RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Notonelazy when node.M > 0: 1647case RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy when node.M > 0: 1655case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.M > 0: 1907if (nextNode.M > 0 && 1917if (!CanCombineCounts(currentNode.M, currentNode.N, nextNode.M, nextNode.N)) 1922currentNode.M += nextNode.M; 1934if (CanCombineCounts(currentNode.M, currentNode.N, 1, 1)) 1960if (CanCombineCounts(currentNode.M, currentNode.N, matchingCharsInMulti, matchingCharsInMulti)) 2002if (CanCombineCounts(1, 1, nextNode.M, nextNode.N)) 2005currentNode.M = nextNode.M + 1; 2486case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when subsequent.M > 0: 2541case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M > 0 && node.Ch != subsequent.Ch: 2542case RegexNodeKind.Notonelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic when subsequent.M > 0 && node.Ch == subsequent.Ch: 2543case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(node.Ch, subsequent.Str!): 2547case RegexNodeKind.Boundary when node.M > 0 && RegexCharClass.IsBoundaryWordChar(node.Ch): 2548case RegexNodeKind.NonBoundary when node.M > 0 && !RegexCharClass.IsBoundaryWordChar(node.Ch): 2549case RegexNodeKind.ECMABoundary when node.M > 0 && RegexCharClass.IsECMAWordChar(node.Ch): 2550case RegexNodeKind.NonECMABoundary when node.M > 0 && !RegexCharClass.IsECMAWordChar(node.Ch): 2553case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M == 0 && node.Ch != subsequent.Ch: 2554case RegexNodeKind.Notonelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic when subsequent.M == 0 && node.Ch == subsequent.Ch: 2555case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !RegexCharClass.CharInClass(node.Ch, subsequent.Str!): 2569case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M > 0 && node.Ch == subsequent.Ch: 2574case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M == 0 && node.Ch == subsequent.Ch: 2589case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M > 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!): 2590case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!): 2594case RegexNodeKind.Boundary when node.M > 0 && RegexCharClass.IsSubsetOf(node.Str!, RegexCharClass.WordClass): 2595case RegexNodeKind.NonBoundary when node.M > 0 && node.Str is RegexCharClass.NotWordClass or RegexCharClass.NotDigitClass: 2596case RegexNodeKind.ECMABoundary when node.M > 0 && node.Str is RegexCharClass.ECMAWordClass or RegexCharClass.ECMADigitClass: 2597case RegexNodeKind.NonECMABoundary when node.M > 0 && node.Str is RegexCharClass.NotECMAWordClass or RegexCharClass.NotDigitClass: 2600case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M == 0 && !RegexCharClass.CharInClass(subsequent.Ch, node.Str!): 2601case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !RegexCharClass.MayOverlap(node.Str!, subsequent.Str!): 2636case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M > 0 && !CharInStartingOrEndingSet(subsequent.Ch): 2637case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M > 0 && !MayOverlapStartingOrEndingSet(subsequent.Str!): 2641case RegexNodeKind.Boundary when node.M > 0 && RegexCharClass.IsSubsetOf(loopStartingSet, RegexCharClass.WordClass) && RegexCharClass.IsSubsetOf(loopEndingSet, RegexCharClass.WordClass): 2642case RegexNodeKind.NonBoundary when node.M > 0 && (loopStartingSet is RegexCharClass.NotWordClass or RegexCharClass.NotDigitClass) && (loopEndingSet is RegexCharClass.NotWordClass or RegexCharClass.NotDigitClass): 2643case RegexNodeKind.ECMABoundary when node.M > 0 && (loopStartingSet is RegexCharClass.ECMAWordClass or RegexCharClass.ECMADigitClass) && (loopEndingSet is RegexCharClass.ECMAWordClass or RegexCharClass.ECMADigitClass): 2644case RegexNodeKind.NonECMABoundary when node.M > 0 && (loopStartingSet is RegexCharClass.NotECMAWordClass or RegexCharClass.NotDigitClass) && (loopEndingSet is RegexCharClass.NotECMAWordClass or RegexCharClass.NotDigitClass): 2647case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when subsequent.M == 0 && !CharInStartingOrEndingSet(subsequent.Ch): 2648case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when subsequent.M == 0 && !MayOverlapStartingOrEndingSet(subsequent.Str!): 2741RegexNodeKind.Loop or RegexNodeKind.Lazyloop when M != N => true, 2744RegexNodeKind.Setloop or RegexNodeKind.Setlazy when M != N => true, 2863return M; 2868return (int)Math.Min(int.MaxValue - 1, (long)M * Child(0).ComputeMinLength()); 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); 3250when node.M == node.N => true, 3518sb.Append(' ').Append($"index = {M}"); 3526sb.Append(' ').Append($"index = {M}"); 3558(M == 0 && N == int.MaxValue) ? "*" : 3559(M == 0 && N == 1) ? "?" : 3560(M == 1 && N == int.MaxValue) ? "+" : 3561(N == int.MaxValue) ? $"{{{M}, *}}" : 3562(N == M) ? $"{{{M}}}" : 3563$"{{{M}, {N}}}");
System\Text\RegularExpressions\RegexNodeKind.cs (14)
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> 128/// One and only one child, the expression in the loop. The minimum number of iterations is in <see cref="RegexNode.M"/>, 134/// One and only one child, the expression in the loop. The minimum number of iterations is in <see cref="RegexNode.M"/>, 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 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\RegexPrefixAnalyzer.cs (26)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength); 164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength); 226case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.M > 0: 228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars 432case RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Onelazy when node.M > 0: 434int count = Math.Min(node.M, SingleCharIterationLimit); 439case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.M > 0: 442int limit = Math.Min(node.M, NodeIterationLimit); 493case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.M > 0: 609case RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic when node.M > 0: 612int minIterations = Math.Min(node.M, MaxLoopExpansion); 618return i == node.M && i == node.N; 641case RegexNodeKind.Setlazy or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when node.M > 0: 643int minIterations = Math.Min(node.M, MaxLoopExpansion); 649return i == node.M && i == node.N; 658case RegexNodeKind.Notonelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic when node.M == node.N: 659distance += node.M; 686case RegexNodeKind.Lazyloop or RegexNodeKind.Loop when node.M > 0: 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 : 1043_ => node.M == 0 ? null : true, 1225(nextChild.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop && nextChild.M >= 1)) 1233(nextChild.Kind is RegexNodeKind.Set || nextChild.M >= 1)) 1303case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.M >= 1: 1362case RegexNodeKind.Loop or RegexNodeKind.Lazyloop when leading && node.M >= 1:
System\Text\RegularExpressions\RegexReplacement.cs (1)
65int slot = child.M;
System\Text\RegularExpressions\RegexWriter.cs (20)
254Emit(RegexOpcode.TestBackreference, RegexParser.MapCaptureNumber(node.M, _tree.CaptureNumberSparseMapping)); 314if (node.N < int.MaxValue || node.M > 1) 315Emit(node.M == 0 ? RegexOpcode.Nullcount : RegexOpcode.Setcount, node.M == 0 ? 0 : 1 - node.M); 317Emit(node.M == 0 ? RegexOpcode.Nullmark : RegexOpcode.Setmark); 319if (node.M == 0) 333if (node.N < int.MaxValue || node.M > 1) 334Emit(RegexOpcode.Branchcount + Lazy, _intStack.Pop(), node.N == int.MaxValue ? int.MaxValue : node.N - node.M); 338if (node.M == 0) 348Emit(RegexOpcode.Capturemark, RegexParser.MapCaptureNumber(node.M, _tree.CaptureNumberSparseMapping), RegexParser.MapCaptureNumber(node.N, _tree.CaptureNumberSparseMapping)); 392if (node.M > 0) 395RegexOpcode.Onerep : RegexOpcode.Notonerep) | bits, node.Ch, node.M); 397if (node.N > node.M) 399Emit((RegexOpcode)node.Kind | bits, node.Ch, node.N == int.MaxValue ? int.MaxValue : node.N - node.M); 408if (node.M > 0) 410Emit(RegexOpcode.Setrep | bits, stringCode, node.M); 412if (node.N > node.M) 414Emit((RegexOpcode)node.Kind | bits, stringCode, (node.N == int.MaxValue) ? int.MaxValue : node.N - node.M); 428Emit((RegexOpcode)node.Kind | bits, RegexParser.MapCaptureNumber(node.M, _tree.CaptureNumberSparseMapping));
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (4)
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)); 272int captureNum = RegexParser.MapCaptureNumber(node.M, _captureSparseMapping);