55 instantiations of RegexNode
System.Text.RegularExpressions (55)
System\Text\RegularExpressions\RegexNode.cs (22)
95
new
RegexNode
(Kind, Options, Str!) :
96
new
RegexNode
(Kind, Options, Ch);
121
return new
RegexNode
(RegexNodeKind.One, options & ~RegexOptions.IgnoreCase, ch);
127
return new
RegexNode
(RegexNodeKind.Set, options & ~RegexOptions.IgnoreCase, stringSet);
131
return new
RegexNode
(RegexNodeKind.One, options, ch);
388
parent.InsertChild(1, new
RegexNode
(RegexNodeKind.UpdateBumpalong, node.Options));
456
var atomic = new
RegexNode
(RegexNodeKind.Atomic, existingChild.Options);
563
0 => new
RegexNode
(Kind == RegexNodeKind.Alternate ? RegexNodeKind.Nothing : RegexNodeKind.Empty, Options),
654
return new
RegexNode
(RegexNodeKind.Empty, child.Options);
837
return new
RegexNode
(RegexNodeKind.Nothing, Options);
930
return new
RegexNode
(RegexNodeKind.Nothing, Options);
1143
var newAlternate = new
RegexNode
(RegexNodeKind.Alternate, alternation.Options);
1153
var atomic = new
RegexNode
(RegexNodeKind.Atomic, alternation.Options);
1160
var newConcat = new
RegexNode
(RegexNodeKind.Concatenate, alternation.Options);
1313
var newAlternate = new
RegexNode
(RegexNodeKind.Alternate, startingNodeOptions);
1357
var atomic = new
RegexNode
(RegexNodeKind.Atomic, startingNodeOptions);
1362
var newConcat = new
RegexNode
(RegexNodeKind.Concatenate, startingNodeOptions);
1510
return new
RegexNode
(RegexNodeKind.Empty, Options);
2010
AddChild(new
RegexNode
(RegexNodeKind.Empty, Options));
2028
AddChild(new
RegexNode
(RegexNodeKind.Empty, Options));
2686
return new
RegexNode
(RegexNodeKind.Empty, Options);
2714
var result = new
RegexNode
(lazy ? RegexNodeKind.Lazyloop : RegexNodeKind.Loop, Options, min, max);
System\Text\RegularExpressions\RegexParser.cs (33)
277
StartGroup(new
RegexNode
(RegexNodeKind.Capture, (_options & ~RegexOptions.IgnoreCase), 0, -1));
347
_unit = new
RegexNode
(RegexNodeKind.Set, _options & ~RegexOptions.IgnoreCase, setString);
394
_unit = new
RegexNode
((_options & RegexOptions.Multiline) != 0 ? RegexNodeKind.Bol : RegexNodeKind.Beginning, _options);
398
_unit = new
RegexNode
((_options & RegexOptions.Multiline) != 0 ? RegexNodeKind.Eol : RegexNodeKind.EndZ, _options);
403
new
RegexNode
(RegexNodeKind.Set, _options & ~RegexOptions.IgnoreCase, RegexCharClass.AnyClass) :
404
new
RegexNode
(RegexNodeKind.Notone, _options & ~RegexOptions.IgnoreCase, '\n');
521
_concatenation = new
RegexNode
(RegexNodeKind.Concatenate, _options);
759
return new
RegexNode
(RegexNodeKind.Group, _options);
763
return new
RegexNode
(RegexNodeKind.Capture, _options, _autocap++, -1);
937
return new
RegexNode
(RegexNodeKind.Capture, _options, capnum, uncapnum);
959
return new
RegexNode
(RegexNodeKind.BackreferenceConditional, _options, capnum);
973
return new
RegexNode
(RegexNodeKind.BackreferenceConditional, _options, tmpCapnum);
1026
return new
RegexNode
(nodeType, _options);
1091
new
RegexNode
(TypeFromCode(ch), _options);
1096
new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.ECMAWordClass : RegexCharClass.WordClass);
1101
new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.NotECMAWordClass : RegexCharClass.NotWordClass);
1106
new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.ECMASpaceClass : RegexCharClass.SpaceClass);
1111
new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.NotECMASpaceClass : RegexCharClass.NotSpaceClass);
1116
new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.ECMADigitClass : RegexCharClass.DigitClass);
1121
new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), (_options & RegexOptions.ECMAScript) != 0 ? RegexCharClass.NotECMADigitClass : RegexCharClass.NotDigitClass);
1138
return new
RegexNode
(RegexNodeKind.Set, (_options & ~RegexOptions.IgnoreCase), cc.ToStringClass());
1203
IsCaptureSlot(capnum) ? new
RegexNode
(RegexNodeKind.Backreference, _options, capnum) :
1235
return scanOnly ? null : new
RegexNode
(RegexNodeKind.Backreference, _options, capnum);
1249
return new
RegexNode
(RegexNodeKind.Backreference, _options, capnum);
1269
_capnames?[capname] is int tmpCapnum ? new
RegexNode
(RegexNodeKind.Backreference, _options, tmpCapnum) :
1345
return new
RegexNode
(RegexNodeKind.Backreference, _options, capnum);
1355
return new
RegexNode
(RegexNodeKind.Backreference, _options, capnum);
1367
return new
RegexNode
(RegexNodeKind.Backreference, _options, tmpCapnum);
1405
return new
RegexNode
(RegexNodeKind.Backreference, _options, capnum);
2022
_concatenation!.AddChild(new
RegexNode
(RegexNodeKind.Multi, _options & ~RegexOptions.IgnoreCase, _pattern.Substring(pos, cch)));
2068
_alternation = new
RegexNode
(RegexNodeKind.Alternate, _options);
2069
_concatenation = new
RegexNode
(RegexNodeKind.Concatenate, _options);
2086
_concatenation = new
RegexNode
(RegexNodeKind.Concatenate, _options);
255 references to RegexNode
System.Text.RegularExpressions (255)
System\Text\RegularExpressions\RegexCompiler.cs (1)
1247
(
RegexNode
LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal) target = _regexTree.FindOptimizations.LiteralAfterLoop.Value;
System\Text\RegularExpressions\RegexFindOptimizations.cs (6)
18
public static RegexFindOptimizations Create(
RegexNode
root, RegexOptions options)
24
RegexPrefixAnalyzer.FindLeadingPositiveLookahead(root) is
RegexNode
positiveLookahead)
46
private RegexFindOptimizations(
RegexNode
root, RegexOptions options, bool isLeadingPartial)
217
(
RegexNode
LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal)? literalAfterLoop = RegexPrefixAnalyzer.FindLiteralFollowingLeadingLoop(root);
336
public (
RegexNode
LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal)? LiteralAfterLoop { get; }
820
(
RegexNode
loopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) literal) = LiteralAfterLoop.GetValueOrDefault();
System\Text\RegularExpressions\RegexNode.cs (127)
19
/// <remarks>null if no children, a <see cref="
RegexNode
"/> if one child, or a <see cref="List{RegexNode}"/> if multiple children.</remarks>
49
public
RegexNode
? Parent;
87
public
RegexNode
CloneCharLoopWithOneLessIteration()
94
RegexNode
newNode = IsSetFamily ?
110
public static
RegexNode
CreateOneWithCaseConversion(char ch, RegexOptions options, CultureInfo? culture, ref RegexCaseBehavior caseBehavior)
135
public
RegexNode
ReverseConcatenationIfRightToLeft()
141
((List<
RegexNode
>)Children!).Reverse();
205
var toExamine = new Stack<
RegexNode
>();
209
RegexNode
node = toExamine.Pop();
215
RegexNode
child = node.Child(i);
329
internal
RegexNode
FinalOptimize()
331
RegexNode
rootNode = this;
369
RegexNode
node = rootNode.Child(0); // skip implicit root capture node
423
RegexNode
node = this;
452
RegexNode
existingChild = node.Child(node.ChildCount() - 1);
456
var
atomic = new RegexNode(RegexNodeKind.Atomic, existingChild.Options);
505
RegexNode
? loopDescendent = node.FindLastExpressionInLoopForAutoAtomic();
522
internal
RegexNode
Reduce()
558
private
RegexNode
ReplaceNodeIfUnnecessary()
575
private
RegexNode
ReduceGroup()
579
RegexNode
u = this;
596
private
RegexNode
ReduceAtomic()
608
RegexNode
atomic = this;
609
RegexNode
child = Child(0);
646
List<
RegexNode
>? branches = child.Children as List<
RegexNode
>;
687
RegexNode
startNode = branches[start];
723
RegexNode
nextChild = branches[next];
765
private
RegexNode
ReduceLoops()
769
RegexNode
u = this;
777
RegexNode
child = u.Child(0);
846
RegexNode
child = u.Child(0);
873
private
RegexNode
ReduceSet()
923
private
RegexNode
ReduceAlternation()
937
RegexNode
node = ReplaceNodeIfUnnecessary();
966
RegexNode
at;
967
RegexNode
prev;
969
List<
RegexNode
> children = (List<
RegexNode
>)Children!;
981
if (at.Children is List<
RegexNode
> atChildren)
991
RegexNode
atChild = (
RegexNode
)at.Children!;
1075
static
RegexNode
ExtractCommonPrefixNode(
RegexNode
alternation)
1078
Debug.Assert(alternation.Children is List<
RegexNode
> { Count: >= 2 });
1079
var children = (List<
RegexNode
>)alternation.Children;
1088
foreach (
RegexNode
child in children)
1098
Debug.Assert(children[startingIndex].Children is List<
RegexNode
> { Count: >= 2 });
1104
RegexNode
required = children[startingIndex].Child(0);
1124
RegexNode
other = children[endingIndex].Child(0);
1143
var
newAlternate = new RegexNode(RegexNodeKind.Alternate, alternation.Options);
1146
((List<
RegexNode
>)children[i].Children!).RemoveAt(0);
1151
if (alternation.Parent is
RegexNode
{ Kind: RegexNodeKind.Atomic })
1153
var
atomic = new RegexNode(RegexNodeKind.Atomic, alternation.Options);
1160
var
newConcat = new RegexNode(RegexNodeKind.Concatenate, alternation.Options);
1174
static
RegexNode
RemoveRedundantEmptiesAndNothings(
RegexNode
node)
1178
var children = (List<
RegexNode
>)node.Children!;
1184
RegexNode
child = children[i];
1217
static
RegexNode
ExtractCommonPrefixText(
RegexNode
alternation)
1220
Debug.Assert(alternation.Children is List<
RegexNode
> { Count: >= 2 });
1221
var children = (List<
RegexNode
>)alternation.Children;
1238
RegexNode
? startingNode = children[startingIndex].FindBranchOneOrMultiStart();
1313
var
newAlternate = new RegexNode(RegexNodeKind.Alternate, startingNodeOptions);
1316
RegexNode
branch = children[i];
1323
static void ProcessOneOrMulti(
RegexNode
node, ReadOnlySpan<char> startingSpan)
1355
if (alternation.Parent is
RegexNode
parent && parent.Kind == RegexNodeKind.Atomic)
1357
var
atomic = new RegexNode(RegexNodeKind.Atomic, startingNodeOptions);
1362
var
newConcat = new RegexNode(RegexNodeKind.Concatenate, startingNodeOptions);
1380
public
RegexNode
? FindBranchOneOrMultiStart()
1382
RegexNode
branch = Kind == RegexNodeKind.Concatenate ? Child(0) : this;
1395
public
RegexNode
? FindStartingLiteralNode(bool allowZeroWidth = true)
1397
RegexNode
? node = this;
1435
if (FindStartingLiteralNode() is
RegexNode
node)
1502
private
RegexNode
ReduceConcatenation()
1519
RegexNode
child = Child(i);
1547
Debug.Assert(Children is List<
RegexNode
>);
1553
List<
RegexNode
> children = (List<
RegexNode
>)Children!;
1556
RegexNode
at = children[i];
1566
if (at.Children is List<
RegexNode
> atChildren)
1576
RegexNode
atChild = (
RegexNode
)at.Children!;
1594
RegexNode
prev = children[--j];
1630
Debug.Assert(Children is List<
RegexNode
>);
1632
var children = (List<
RegexNode
>)Children!;
1637
RegexNode
currentNode = children[current];
1638
RegexNode
nextNode = children[next];
1834
Debug.Assert(Children is List<
RegexNode
>);
1835
var children = (List<
RegexNode
>)Children;
1840
static void ProcessNode(
RegexNode
node,
RegexNode
subsequent)
1864
RegexNode
? loopDescendent = node.FindLastExpressionInLoopForAutoAtomic();
1935
private
RegexNode
? FindLastExpressionInLoopForAutoAtomic()
1937
RegexNode
node = this;
1959
RegexNode
lastConcatChild = node.Child(concatCount - 1);
1971
private
RegexNode
ReduceLookaround()
1999
private
RegexNode
ReduceBackreferenceConditional()
2017
private
RegexNode
ReduceExpressionConditional()
2036
RegexNode
condition = Child(0);
2055
private static bool CanBeMadeAtomic(
RegexNode
node,
RegexNode
subsequent, bool iterateNullableSubsequent, bool allowLazy)
2212
RegexNode
? parent = subsequent.Parent;
2222
var peers = (List<
RegexNode
>)parent.Children!;
2531
RegexNode
child = Child(i);
2638
static bool CanJoinLengthCheck(
RegexNode
node) => node.Kind switch
2649
RegexNode
child = Child(childIndex);
2677
public
RegexNode
MakeQuantifier(bool lazy, int min, int max)
2714
var
result = new RegexNode(lazy ? RegexNodeKind.Lazyloop : RegexNodeKind.Loop, Options, min, max);
2720
public void AddChild(
RegexNode
newChild)
2730
else if (Children is
RegexNode
currentChild)
2732
Children = new List<
RegexNode
>() { currentChild, newChild };
2736
((List<
RegexNode
>)Children).Add(newChild);
2740
public void InsertChild(int index,
RegexNode
newChild)
2742
Debug.Assert(Children is List<
RegexNode
>);
2748
((List<
RegexNode
>)Children).Insert(index, newChild);
2751
public void ReplaceChild(int index,
RegexNode
newChild)
2760
if (Children is
RegexNode
)
2766
((List<
RegexNode
>)Children)[index] = newChild;
2770
public
RegexNode
Child(int i) => Children is
RegexNode
child ? child : ((List<
RegexNode
>)Children!)[i];
2779
if (Children is List<
RegexNode
> children)
2784
Debug.Assert(Children is
RegexNode
);
2815
static bool ExceedsMaxDepthAllowedDepth(
RegexNode
node, int allowedDepth)
2849
RegexNode
? curNode = this;
System\Text\RegularExpressions\RegexNodeKind.cs (42)
6
/// <summary>Specifies the kind of a <see cref="
RegexNode
"/>.</summary>
16
/// <remarks>The character is specified in <see cref="
RegexNode
.Ch"/>.</remarks>
19
/// <remarks>The character is specified in <see cref="
RegexNode
.Ch"/>.</remarks>
22
/// <remarks>The <see cref="RegexCharClass"/> set string is specified in <see cref="
RegexNode
.Str"/>.</remarks>
26
/// <remarks>The characters are specified in <see cref="
RegexNode
.Str"/>. This is purely a representational optimization, equivalent to multiple <see cref="One"/> nodes concatenated together.</remarks>
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>
126
/// <summary>A loop around an arbitrary <see cref="
RegexNode
"/>, e.g. `(ab|cd)*`.</summary>
128
/// One and only one child, the expression in the loop. The minimum number of iterations is in <see cref="
RegexNode
.M"/>,
129
/// and the maximum number of iterations is in <see cref="
RegexNode
.N"/>.
132
/// <summary>A lazy loop around an arbitrary <see cref="
RegexNode
"/>, e.g. `(ab|cd)*?`.</summary>
134
/// One and only one child, the expression in the loop. The minimum number of iterations is in <see cref="
RegexNode
.M"/>,
135
/// and the maximum number of iterations is in <see cref="
RegexNode
.N"/>.
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
142
/// group, <see cref="
RegexNode
.N"/> is the uncapture.
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\RegexParser.cs (23)
24
private
RegexNode
? _stack;
25
private
RegexNode
? _group;
26
private
RegexNode
? _alternation;
27
private
RegexNode
? _concatenation;
28
private
RegexNode
? _unit;
109
RegexNode
root = parser.ScanRegex();
144
RegexNode
root = parser.ScanReplacement();
270
private
RegexNode
ScanRegex()
332
_unit =
RegexNode
.CreateOneWithCaseConversion(_pattern[endpos - 1], _options, _culture, ref _caseBehavior);
353
if (ScanGroupOpen() is
RegexNode
grouper)
519
private
RegexNode
ScanReplacement()
748
private
RegexNode
? ScanGroupOpen()
1076
private
RegexNode
? ScanBackslash(bool scanOnly)
1141
RegexNode
? result = ScanBasicBackslash(scanOnly);
1151
private
RegexNode
? ScanBasicBackslash(bool scanOnly)
1280
RegexNode
.CreateOneWithCaseConversion(ch, _options, _culture, ref _caseBehavior) :
1285
private
RegexNode
ScanDollar()
1289
return
RegexNode
.CreateOneWithCaseConversion('$', _options, _culture, ref _caseBehavior);
1379
return
RegexNode
.CreateOneWithCaseConversion('$', _options, _culture, ref _caseBehavior);
1412
return
RegexNode
.CreateOneWithCaseConversion('$', _options, _culture, ref _caseBehavior);
2018
_concatenation!.AddChild(
RegexNode
.CreateOneWithCaseConversion(_pattern[pos], isReplacement ? _options & ~RegexOptions.IgnoreCase : _options, _culture, ref _caseBehavior));
2028
_concatenation!.AddChild(
RegexNode
.CreateOneWithCaseConversion(c, _options, _culture, ref _caseBehavior));
2065
private void StartGroup(
RegexNode
openGroup)
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (23)
21
public static string[]? FindPrefixes(
RegexNode
node, bool ignoreCase)
57
static bool FindPrefixesCore(
RegexNode
node, List<StringBuilder> results, bool ignoreCase)
340
public static string FindPrefix(
RegexNode
node)
348
static bool Process(
RegexNode
node, ref ValueStringBuilder vsb)
483
public static string? FindPrefixOrdinalCaseInsensitive(
RegexNode
node)
511
public static List<RegexFindOptimizations.FixedDistanceSet>? FindFixedDistanceSets(
RegexNode
root, bool thorough)
586
static bool TryFindRawFixedSets(
RegexNode
node, List<RegexFindOptimizations.FixedDistanceSet> results, ref int distance, bool thorough)
904
public static string? FindFirstCharClass(
RegexNode
root)
933
static bool? TryFindFirstCharClass(
RegexNode
node, ref RegexCharClass? cc)
1103
public static (
RegexNode
LoopNode, (char Char, string? String, StringComparison StringComparison, char[]? Chars) Literal)? FindLiteralFollowingLeadingLoop(
RegexNode
node)
1130
RegexNode
firstChild = node.Child(0);
1142
RegexNode
nextChild = node.Child(1);
1232
public static
RegexNode
? FindLeadingPositiveLookahead(
RegexNode
node)
1234
RegexNode
? positiveLookahead = null;
1239
static bool FindLeadingPositiveLookahead(
RegexNode
node, ref
RegexNode
? positiveLookahead)
1306
public static RegexNodeKind FindLeadingAnchor(
RegexNode
node) =>
1310
public static RegexNodeKind FindTrailingAnchor(
RegexNode
node) =>
1314
private static RegexNodeKind FindLeadingOrTrailingAnchor(
RegexNode
node, bool leading)
1357
RegexNode
? child = null;
1363
RegexNode
tmpChild = node.Child(i);
System\Text\RegularExpressions\RegexReplacement.cs (2)
34
public RegexReplacement(string rep,
RegexNode
concat, Hashtable _caps)
46
RegexNode
child = concat.Child(i);
System\Text\RegularExpressions\RegexTree.cs (4)
11
/// Provides the core data describing a parsed <see cref="
RegexNode
"/> tree, along with necessary
18
/// <summary>The root node of the parsed <see cref="
RegexNode
"/> tree.</summary>
19
public readonly
RegexNode
Root;
43
internal RegexTree(
RegexNode
root, int captureCount, string[]? captureNames, Hashtable? captureNameToNumberMapping, Hashtable? captureNumberSparseMapping, RegexOptions options, CultureInfo? culture)
System\Text\RegularExpressions\RegexTreeAnalyzer.cs (14)
9
/// <summary>Analyzes a <see cref="RegexTree"/> of <see cref="
RegexNode
"/>s to produce data on the tree structure, in particular in support of code generation.</summary>
19
static bool TryAnalyze(
RegexNode
node, AnalysisResults results, bool isAtomicByAncestor, bool isInLoop)
33
(results._inLoops ??= new HashSet<
RegexNode
>()).Add(node);
52
(results._mayBacktrack ??= new HashSet<
RegexNode
>()).Add(node);
85
RegexNode
child = node.Child(i);
135
(results._mayBacktrack ??= new HashSet<
RegexNode
>()).Add(node);
158
internal readonly HashSet<
RegexNode
> _isAtomicByAncestor = new(); // since the root is implicitly atomic, every tree will contain atomic-by-ancestor nodes
160
internal readonly HashSet<
RegexNode
> _containsCapture = new(); // the root is a capture, so this will always contain at least the root node
162
internal HashSet<
RegexNode
>? _mayBacktrack;
164
internal HashSet<
RegexNode
>? _inLoops;
183
public bool IsAtomicByAncestor(
RegexNode
node) => _isAtomicByAncestor.Contains(node);
191
public bool MayContainCapture(
RegexNode
node) => !_complete || _containsCapture.Contains(node);
204
public bool MayBacktrack(
RegexNode
node) => !_complete || (_mayBacktrack?.Contains(node) ?? false);
224
public bool IsInLoop(
RegexNode
node) => !_complete || (_inLoops?.Contains(node) ?? false);
System\Text\RegularExpressions\RegexWriter.cs (2)
78
RegexNode
curNode = _tree.Root;
201
private void EmitFragment(RegexNodeKind nodeType,
RegexNode
node, int curIndex)
System\Text\RegularExpressions\Symbolic\DoublyLinkedList.cs (2)
14
/// <see cref="AddLast(DoublyLinkedList{T})"/> operation is made use of in the <see cref="RegexNodeConverter.ConvertToSymbolicRegexNode(
RegexNode
)"/> method
15
/// where it maintains linear construction time in terms of the overall number of AST nodes in a given <see cref="
RegexNode
"/> input.
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (8)
13
/// <summary>Provides functionality to convert <see cref="
RegexNode
"/>s to corresponding <see cref="SymbolicRegexNode{S}"/>s.</summary>
26
/// <summary>Converts the root <see cref="
RegexNode
"/> into its corresponding <see cref="SymbolicRegexNode{S}"/>.</summary>
29
internal SymbolicRegexNode<BDD> ConvertToSymbolicRegexNode(
RegexNode
root)
37
Stack<(
RegexNode
Node, DoublyLinkedList<SymbolicRegexNode<BDD>> Result, DoublyLinkedList<SymbolicRegexNode<BDD>>[]? ChildResults)> stack = new();
42
while (stack.TryPop(out (
RegexNode
Node, DoublyLinkedList<SymbolicRegexNode<BDD>> Result, DoublyLinkedList<SymbolicRegexNode<BDD>>[]? ChildResults) popped))
44
RegexNode
node = popped.Node;
191
static string UnexpectedNodeType(
RegexNode
node)
310
SymbolicRegexNode<BDD> ConvertSet(
RegexNode
node)