12 writes to N
System.Text.RegularExpressions.Generator (12)
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (12)
83
N
= n;
99
newNode.
N
= N == int.MaxValue ? int.MaxValue : N - 1;
154
N
= max;
182
N
= M;
200
M =
N
= 0;
209
M =
N
= 0;
218
N
= M;
890
u.
N
= max = ((int.MaxValue - 1) / u.N < max) ? int.MaxValue : u.N * max;
1867
currentNode.
N
= nextNode.N == int.MaxValue ? int.MaxValue : currentNode.N + nextNode.N;
1881
currentNode.
N
++;
1908
currentNode.
N
+= matchingCharsInMulti;
1948
currentNode.
N
= nextNode.N == int.MaxValue ? int.MaxValue : nextNode.N + 1;
108 references to N
System.Text.RegularExpressions.Generator (108)
RegexGenerator.Emitter.cs (34)
1503
Debug.Assert(target.LoopNode.
N
== int.MaxValue);
2629
int uncapnum = RegexParser.MapCaptureNumber(node.
N
, rm.Tree.CaptureNumberSparseMapping);
3126
child.M == child.
N
&&
3409
if (node.M == node.
N
)
3419
Debug.Assert(node.M < node.
N
);
3481
node.
N
> 1 && // no point in using IndexOf for small loops, in particular optionals
3549
if (node.M == node.
N
|| rm.Analysis.IsAtomicByAncestor(node))
3560
Debug.Assert(node.M < node.
N
);
3571
if (node.
N
!= int.MaxValue)
3573
maxIterations = $"{node.
N
- node.M}";
3786
Debug.Assert(node.
N
>= node.M, $"Unexpected M={node.M}, N={node.
N
}");
3791
int maxIterations = node.
N
;
4207
if (node.M == node.
N
)
4214
if (node.M == 0 && node.
N
== 1)
4220
Debug.Assert(node.
N
> node.M);
4222
int maxIterations = node.
N
;
4337
Debug.Assert(node.M == 0 && node.
N
== 1);
4376
Debug.Assert(node.M == node.
N
, $"Unexpected M={node.M} == N={node.
N
}");
4396
Debug.Assert(node.
N
>= node.M, $"Unexpected M={node.M}, N={node.
N
}");
4401
int maxIterations = node.
N
;
5546
RegexNodeKind.Capture when node.M == -1 && node.
N
!= -1 => $"Non-capturing balancing group. Uncaptures the {DescribeCapture(node.
N
, rm)}.",
5547
RegexNodeKind.Capture when node.
N
!= -1 => $"Balancing group. Captures the {DescribeCapture(node.M, rm)} and uncaptures the {DescribeCapture(node.
N
, rm)}.",
5548
RegexNodeKind.Capture when node.
N
== -1 => $"{DescribeCapture(node.M, rm)}.",
5555
RegexNodeKind.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",
5791
node.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)
99
newNode.N =
N
== int.MaxValue ? int.MaxValue :
N
- 1;
185
if (
N
== 0)
193
else if (Kind == RegexNodeKind.Oneloopatomic &&
N
is >= 2 and <= MultiVsRepeaterLimit)
198
Str = new string(Ch,
N
);
207
RegexNode loopAsChild = new(RegexNodeKind.Loop, Options, M,
N
);
221
if (
N
!= 0)
424
case RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic when node.
N
== int.MaxValue:
425
case RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when node.
N
== int.MaxValue && !atomicByAncestry:
552
if (node.
N
== 1 || CanBeMadeAtomic(node.Child(0), node.Child(0), iterateNullableSubsequent: false, allowLazy: false))
832
int max =
N
;
876
if (u.M == 0 && child.M > 1 || child.
N
< child.M * 2)
888
if (u.
N
> 0)
890
u.N = max = ((int.MaxValue - 1) / u.
N
< max) ? int.MaxValue : u.
N
* max;
910
child.MakeRep(u.Kind == RegexNodeKind.Lazyloop ? RegexNodeKind.Onelazy : RegexNodeKind.Oneloop, u.M, u.
N
);
1210
case RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop or RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy when required.M == required.
N
:
1230
required.
N
!= other.
N
||
1859
if (!CanCombineCounts(currentNode.M, currentNode.
N
, nextNode.M, nextNode.
N
))
1865
if (currentNode.
N
!= int.MaxValue)
1867
currentNode.N = nextNode.
N
== int.MaxValue ? int.MaxValue : currentNode.
N
+ nextNode.
N
;
1876
if (CanCombineCounts(currentNode.M, currentNode.
N
, 1, 1))
1879
if (currentNode.
N
!= int.MaxValue)
1902
if (CanCombineCounts(currentNode.M, currentNode.
N
, matchingCharsInMulti, matchingCharsInMulti))
1906
if (currentNode.
N
!= int.MaxValue)
1944
if (CanCombineCounts(1, 1, nextNode.M, nextNode.
N
))
1948
currentNode.N = nextNode.
N
== int.MaxValue ? int.MaxValue : nextNode.
N
+ 1;
2121
if (node.
N
== 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: false))
2131
if (node.
N
== 1 || CanBeMadeAtomic(child, child, iterateNullableSubsequent: false, allowLazy: true))
2186
if (node is { Kind: RegexNodeKind.Capture,
N
: -1 })
2505
(node.
N
> 1 && RegexCharClass.MayOverlap(loopStartingSet, loopEndingSet)))
2604
RegexNodeKind.Loop or RegexNodeKind.Lazyloop when M !=
N
=> true,
2607
RegexNodeKind.Setloop or RegexNodeKind.Setlazy when M !=
N
=> true,
2833
return
N
== int.MaxValue ? null :
N
;
2836
if (
N
!= int.MaxValue)
2841
long maxLength = (long)
N
* childMaxLength;
2999
(child.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic && child.M == child.
N
))
3070
when node.M == node.
N
=> true,
3331
if (
N
!= -1)
3333
sb.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)
119
return node.Kind is RegexNodeKind.One || reps == node.
N
;
209
return node.Kind is RegexNodeKind.Set || reps == node.
N
;
236
return limit == node.
N
;
436
return count == node.
N
&& !rtl;
450
return limit == node.
N
&& !rtl;
618
return i == node.M && i == node.
N
;
649
return i == node.M && i == node.
N
;
658
case RegexNodeKind.Notonelazy or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic when node.M == node.
N
:
1159
if (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)
107
RegexNodeKind.Loop or RegexNodeKind.Lazyloop when node.
N
== 1 => true,