297 references to SymbolicRegexNodeKind
System.Text.RegularExpressions (297)
System\Text\RegularExpressions\Symbolic\MatchingState.cs (1)
147if (Node.Kind != SymbolicRegexNodeKind.DisableBacktrackingSimulation)
System\Text\RegularExpressions\Symbolic\SymbolicRegexBuilder.cs (29)
31internal SymbolicRegexNode<TSet> BeginningAnchor => _beginningAnchor ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.BeginningAnchor); 34internal SymbolicRegexNode<TSet> EndAnchor => _endAnchor ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.EndAnchor); 37internal SymbolicRegexNode<TSet> EndAnchorZ => _endAnchorZ ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.EndAnchorZ); 40internal SymbolicRegexNode<TSet> EndAnchorZReverse => _endAnchorZReverse ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.EndAnchorZReverse); 43internal SymbolicRegexNode<TSet> BolAnchor => _bolAnchor ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.BOLAnchor); 46internal SymbolicRegexNode<TSet> EolAnchor => _eolAnchor ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.EOLAnchor); 49internal SymbolicRegexNode<TSet> BoundaryAnchor => _wbAnchor ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.BoundaryAnchor); 52internal SymbolicRegexNode<TSet> NonBoundaryAnchor => _nwbAnchor ??= SymbolicRegexNode<TSet>.CreateAnchor(this, SymbolicRegexNodeKind.NonBoundaryAnchor); 72SymbolicRegexNodeKind kind, SymbolicRegexNode<TSet>? left, SymbolicRegexNode<TSet>? right, 76public readonly SymbolicRegexNodeKind Kind = kind; 232if (!isLazy && lower == 0 && upper == int.MaxValue && node._kind == SymbolicRegexNodeKind.Singleton) 242if (node.Kind == SymbolicRegexNodeKind.Loop && node._lower == 0 && node._upper == 1 && lower == 0 && upper == 1) 293case SymbolicRegexNodeKind.BeginningAnchor: 296case SymbolicRegexNodeKind.EndAnchor: 299case SymbolicRegexNodeKind.EndAnchorZ: 302case SymbolicRegexNodeKind.EndAnchorZReverse: 305case SymbolicRegexNodeKind.BOLAnchor: 308case SymbolicRegexNodeKind.EOLAnchor: 311case SymbolicRegexNodeKind.BoundaryAnchor: 314case SymbolicRegexNodeKind.NonBoundaryAnchor: 317case SymbolicRegexNodeKind.FixedLengthMarker: 320case SymbolicRegexNodeKind.Epsilon: 323case SymbolicRegexNodeKind.Singleton: 327case SymbolicRegexNodeKind.Loop: 331case SymbolicRegexNodeKind.Alternate: 338case SymbolicRegexNodeKind.CaptureStart: 341case SymbolicRegexNodeKind.CaptureEnd: 344case SymbolicRegexNodeKind.Concat: 355case SymbolicRegexNodeKind.DisableBacktrackingSimulation:
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Automata.cs (9)
196if (node._kind is not SymbolicRegexNodeKind.Concat) 198if (node._kind is SymbolicRegexNodeKind.CaptureStart) 208if (left._kind is SymbolicRegexNodeKind.CaptureEnd or SymbolicRegexNodeKind.BoundaryAnchor or SymbolicRegexNodeKind.Singleton) 211if (left._kind is SymbolicRegexNodeKind.Singleton) 216else if (left._kind is SymbolicRegexNodeKind.Loop) 218if (left._lower <= 0 || left._left!.Kind is not SymbolicRegexNodeKind.Singleton) 296Debug.Assert(node.Kind != SymbolicRegexNodeKind.Alternate);
System\Text\RegularExpressions\Symbolic\SymbolicRegexNode.cs (258)
35internal readonly SymbolicRegexNodeKind _kind; 62private SymbolicRegexNode(SymbolicRegexBuilder<TSet> builder, SymbolicRegexNodeKind kind, SymbolicRegexNode<TSet>? left, SymbolicRegexNode<TSet>? right, int lower, int upper, TSet set, SymbolicRegexInfo info) 78private static SymbolicRegexNode<TSet> Create(SymbolicRegexBuilder<TSet> builder, SymbolicRegexNodeKind kind, SymbolicRegexNode<TSet>? left, SymbolicRegexNode<TSet>? right, int lower, int upper, TSet? set, SymbolicRegexInfo info) 80Debug.Assert(kind != SymbolicRegexNodeKind.Singleton || set is not null); 81TSet setOrStartSet = kind == SymbolicRegexNodeKind.Singleton ? set! : ComputeStartSet(builder, kind, left, right); 123case SymbolicRegexNodeKind.Loop: 127case SymbolicRegexNodeKind.Concat: 138case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 139case SymbolicRegexNodeKind.Effect: 140case SymbolicRegexNodeKind.Alternate: 153Debug.Assert(node._kind is SymbolicRegexNodeKind.BeginningAnchor or 154SymbolicRegexNodeKind.EndAnchor or 155SymbolicRegexNodeKind.BOLAnchor or 156SymbolicRegexNodeKind.EOLAnchor or 157SymbolicRegexNodeKind.BoundaryAnchor or 158SymbolicRegexNodeKind.NonBoundaryAnchor or 159SymbolicRegexNodeKind.EndAnchorZ or 160SymbolicRegexNodeKind.EndAnchorZReverse); 185public List<SymbolicRegexNode<TSet>> ToList(List<SymbolicRegexNode<TSet>>? list = null, SymbolicRegexNodeKind listKind = SymbolicRegexNodeKind.Concat) 187Debug.Assert(listKind is SymbolicRegexNodeKind.Concat or SymbolicRegexNodeKind.Alternate); 192static void AppendToList(SymbolicRegexNode<TSet> concat, List<SymbolicRegexNode<TSet>> list, SymbolicRegexNodeKind listKind) 257case SymbolicRegexNodeKind.Loop: 262case SymbolicRegexNodeKind.Concat: 267case SymbolicRegexNodeKind.Alternate: 272case SymbolicRegexNodeKind.BeginningAnchor: 276case SymbolicRegexNodeKind.EndAnchor: 280case SymbolicRegexNodeKind.BOLAnchor: 286case SymbolicRegexNodeKind.EOLAnchor: 292case SymbolicRegexNodeKind.BoundaryAnchor: 297case SymbolicRegexNodeKind.NonBoundaryAnchor: 302case SymbolicRegexNodeKind.EndAnchorZ: 308case SymbolicRegexNodeKind.CaptureStart: 309case SymbolicRegexNodeKind.CaptureEnd: 313case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 314case SymbolicRegexNodeKind.Effect: 323Debug.Assert(_kind == SymbolicRegexNodeKind.EndAnchorZReverse); 340if (_left._kind == SymbolicRegexNodeKind.Singleton) 353if (_kind == SymbolicRegexNodeKind.Singleton) 366public bool IsEpsilon => _kind == SymbolicRegexNodeKind.Epsilon; 369internal SymbolicRegexNodeKind Kind => _kind; 379Create(builder, SymbolicRegexNodeKind.Singleton, null, null, -1, -1, builder._solver.Empty, default); 382Create(builder, SymbolicRegexNodeKind.Singleton, null, null, -1, -1, builder._solver.Full, default); 385Create(builder, SymbolicRegexNodeKind.FixedLengthMarker, null, null, length, -1, default, SymbolicRegexInfo.Epsilon()); 388Create(builder, SymbolicRegexNodeKind.Epsilon, null, null, -1, -1, default, SymbolicRegexInfo.Epsilon()); 390internal static SymbolicRegexNode<TSet> CreateAnchor(SymbolicRegexBuilder<TSet> builder, SymbolicRegexNodeKind kind) 393SymbolicRegexNodeKind.BoundaryAnchor or SymbolicRegexNodeKind.NonBoundaryAnchor or 394SymbolicRegexNodeKind.BeginningAnchor or SymbolicRegexNodeKind.EndAnchor or 395SymbolicRegexNodeKind.EndAnchorZ or SymbolicRegexNodeKind.EndAnchorZReverse or 396SymbolicRegexNodeKind.EOLAnchor or SymbolicRegexNodeKind.BOLAnchor); 400isLineAnchor: kind is SymbolicRegexNodeKind.EndAnchorZ or SymbolicRegexNodeKind.EndAnchorZReverse or SymbolicRegexNodeKind.EOLAnchor or SymbolicRegexNodeKind.BOLAnchor, 401isEndZAnchor: kind is SymbolicRegexNodeKind.EndAnchorZ)); 407Create(builder, SymbolicRegexNodeKind.Singleton, null, null, -1, -1, set, default); 414if (lower == 0 && upper == 1 && body._kind == SymbolicRegexNodeKind.Loop && body._lower == 0 && body._upper == 1) 419return Create(builder, SymbolicRegexNodeKind.Loop, body, null, lower, upper, default, SymbolicRegexInfo.Loop(body._info, lower, isLazy)); 430if (node._kind == SymbolicRegexNodeKind.Effect) 436return Create(builder, SymbolicRegexNodeKind.Effect, node, effectNode, -1, -1, default, SymbolicRegexInfo.Effect(node._info)); 440Create(builder, SymbolicRegexNodeKind.CaptureStart, null, null, captureNum, -1, default, SymbolicRegexInfo.Epsilon()); 443Create(builder, SymbolicRegexNodeKind.CaptureEnd, null, null, captureNum, -1, default, SymbolicRegexInfo.Epsilon()); 446Create(builder, SymbolicRegexNodeKind.DisableBacktrackingSimulation, child, null, -1, -1, default, child._info); 462Debug.Assert(right._kind is not SymbolicRegexNodeKind.Effect); 463if (left._kind == SymbolicRegexNodeKind.Effect) 469return Create(builder, SymbolicRegexNodeKind.Concat, left, right, -1, -1, default, SymbolicRegexInfo.Concat(left._info, right._info)); 497SymbolicRegexNode<TSet> head = right._kind == SymbolicRegexNodeKind.Alternate ? right._left! : right; 498SymbolicRegexNode<TSet> tail = right._kind == SymbolicRegexNodeKind.Alternate ? right._right! : builder._nothing; 514if (!deduplicated && left._kind != SymbolicRegexNodeKind.Alternate) 519while (current._kind == SymbolicRegexNodeKind.Alternate) 523Debug.Assert(current._left._kind != SymbolicRegexNodeKind.Alternate); 537if (!deduplicated || left._kind == SymbolicRegexNodeKind.Alternate) 540List<SymbolicRegexNode<TSet>> elems = left.ToList(listKind: SymbolicRegexNodeKind.Alternate); 542right.ToList(elems, listKind: SymbolicRegexNodeKind.Alternate); 583Debug.Assert(left._kind != SymbolicRegexNodeKind.Alternate); 586return Create(builder, SymbolicRegexNodeKind.Alternate, left, right, -1, -1, default, SymbolicRegexInfo.Alternate(left._info, right._info)); 651if (left._kind == SymbolicRegexNodeKind.Effect) 659if (right._kind == SymbolicRegexNodeKind.Effect) 667if (left._kind == SymbolicRegexNodeKind.Concat && right._kind == SymbolicRegexNodeKind.Concat) 671if (left._left.IsNullable && rl._kind == SymbolicRegexNodeKind.Loop && rl._lower == 0 && rl._upper == 1 && rl.IsLazy) 681if (left._kind == SymbolicRegexNodeKind.Concat && right._kind == SymbolicRegexNodeKind.Concat) 685if (ll._kind == SymbolicRegexNodeKind.Loop && ll._lower == 0 && ll._upper == 1 && ll.IsLazy) 694if (left._kind == SymbolicRegexNodeKind.Concat) 713while (prefix._kind == SymbolicRegexNodeKind.Concat) 716if (node._kind != SymbolicRegexNodeKind.Concat) 728if (node._kind != SymbolicRegexNodeKind.Concat) 750while (current._kind == SymbolicRegexNodeKind.Effect) 789if (left._kind == SymbolicRegexNodeKind.Effect) 812if (right._kind == SymbolicRegexNodeKind.Effect) 821if (right._kind == SymbolicRegexNodeKind.Concat) 842while (suffix._kind == SymbolicRegexNodeKind.Concat) 892case SymbolicRegexNodeKind.FixedLengthMarker: 893case SymbolicRegexNodeKind.Epsilon: 894case SymbolicRegexNodeKind.BOLAnchor: 895case SymbolicRegexNodeKind.EOLAnchor: 896case SymbolicRegexNodeKind.EndAnchor: 897case SymbolicRegexNodeKind.BeginningAnchor: 898case SymbolicRegexNodeKind.EndAnchorZ: 899case SymbolicRegexNodeKind.EndAnchorZReverse: 900case SymbolicRegexNodeKind.BoundaryAnchor: 901case SymbolicRegexNodeKind.NonBoundaryAnchor: 902case SymbolicRegexNodeKind.CaptureStart: 903case SymbolicRegexNodeKind.CaptureEnd: 906case SymbolicRegexNodeKind.Singleton: 909case SymbolicRegexNodeKind.Loop: 927case SymbolicRegexNodeKind.Concat: 946case SymbolicRegexNodeKind.Alternate: 960case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 961case SymbolicRegexNodeKind.Effect: 970/// Insert <see cref="SymbolicRegexNodeKind.FixedLengthMarker"/> nodes to mark paths in the regex that correspond 989case SymbolicRegexNodeKind.Alternate: 996case SymbolicRegexNodeKind.Concat: 1012case SymbolicRegexNodeKind.FixedLengthMarker: 1066if (_kind == SymbolicRegexNodeKind.DisableBacktrackingSimulation) 1102case SymbolicRegexNodeKind.Alternate: 1113case SymbolicRegexNodeKind.Concat: 1119SymbolicRegexNodeKind.Concat => CreateConcat(builder, _left._left!, CreateConcat(builder, _left._right!, _right)) 1126SymbolicRegexNodeKind.Alternate => (_left._left!.IsNullableFor(context) ? 1131SymbolicRegexNodeKind.Loop => PruneLoop(builder, context, _left, _right), 1138case SymbolicRegexNodeKind.Loop: 1143case SymbolicRegexNodeKind.Effect: 1160Debug.Assert(loop.Kind == SymbolicRegexNodeKind.Loop && loop._left is not null); 1214Debug.Assert(_kind == SymbolicRegexNodeKind.Loop && _left is not null); 1236/// -Some nodes, namely <see cref="SymbolicRegexNodeKind.CaptureStart"/> and <see cref="SymbolicRegexNodeKind.CaptureEnd"/>, 1237/// will produce <see cref="SymbolicRegexNodeKind.Effect"/> nodes, which indicate effects to be applied on 1265case SymbolicRegexNodeKind.Singleton: 1283case SymbolicRegexNodeKind.Concat: 1315case SymbolicRegexNodeKind.Loop: 1336case SymbolicRegexNodeKind.Alternate: 1343case SymbolicRegexNodeKind.Effect: 1378case SymbolicRegexNodeKind.Effect: 1383case SymbolicRegexNodeKind.Concat: 1388case SymbolicRegexNodeKind.Alternate: 1392List<SymbolicRegexNode<TSet>> elems = ToList(listKind: SymbolicRegexNodeKind.Alternate); 1397case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 1401case SymbolicRegexNodeKind.Loop: 1412/// This function maps <see cref="SymbolicRegexNodeKind.Effect"/> nodes present in the tree and maps them into 1450case SymbolicRegexNodeKind.Effect: 1461case SymbolicRegexNodeKind.Concat: 1477case SymbolicRegexNodeKind.Alternate: 1483case SymbolicRegexNodeKind.Loop when _lower == 0 && _upper == 1: 1502case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 1541case SymbolicRegexNodeKind.Concat: 1548case SymbolicRegexNodeKind.Loop: 1558case SymbolicRegexNodeKind.Alternate: 1573case SymbolicRegexNodeKind.CaptureStart: 1577case SymbolicRegexNodeKind.CaptureEnd: 1581case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 1607case SymbolicRegexNodeKind.EndAnchor: 1611case SymbolicRegexNodeKind.BeginningAnchor: 1615case SymbolicRegexNodeKind.BOLAnchor: 1619case SymbolicRegexNodeKind.EOLAnchor: 1623case SymbolicRegexNodeKind.Epsilon: 1627case SymbolicRegexNodeKind.FixedLengthMarker: 1632case SymbolicRegexNodeKind.BoundaryAnchor: 1636case SymbolicRegexNodeKind.NonBoundaryAnchor: 1640case SymbolicRegexNodeKind.EndAnchorZ: 1644case SymbolicRegexNodeKind.EndAnchorZReverse: 1648case SymbolicRegexNodeKind.Alternate: 1657case SymbolicRegexNodeKind.Concat: 1660if (_left.Kind == SymbolicRegexNodeKind.Concat) 1663if (_left.Kind == SymbolicRegexNodeKind.Concat) 1668case SymbolicRegexNodeKind.Singleton: 1673case SymbolicRegexNodeKind.Loop: 1732case SymbolicRegexNodeKind.Effect: 1744case SymbolicRegexNodeKind.CaptureStart: 1751case SymbolicRegexNodeKind.CaptureEnd: 1758case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 1772case SymbolicRegexNodeKind.Singleton: 1838case SymbolicRegexNodeKind.BOLAnchor: 1839case SymbolicRegexNodeKind.EOLAnchor: 1840case SymbolicRegexNodeKind.EndAnchorZ: 1841case SymbolicRegexNodeKind.EndAnchorZReverse: 1845case SymbolicRegexNodeKind.BeginningAnchor: 1846case SymbolicRegexNodeKind.EndAnchor: 1847case SymbolicRegexNodeKind.Epsilon: 1848case SymbolicRegexNodeKind.FixedLengthMarker: 1849case SymbolicRegexNodeKind.CaptureStart: 1850case SymbolicRegexNodeKind.CaptureEnd: 1853case SymbolicRegexNodeKind.Singleton: 1858case SymbolicRegexNodeKind.Loop: 1863case SymbolicRegexNodeKind.Alternate: 1869case SymbolicRegexNodeKind.Concat: 1872while (conc._kind == SymbolicRegexNodeKind.Concat) 1881case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 1886case SymbolicRegexNodeKind.NonBoundaryAnchor: 1887case SymbolicRegexNodeKind.BoundaryAnchor: 1913case SymbolicRegexNodeKind.Loop: 1917case SymbolicRegexNodeKind.Concat: 1922while (rest._kind == SymbolicRegexNodeKind.Concat) 1934case SymbolicRegexNodeKind.Alternate: 1938case SymbolicRegexNodeKind.FixedLengthMarker: 1942case SymbolicRegexNodeKind.BeginningAnchor: 1946case SymbolicRegexNodeKind.EndAnchor: 1949case SymbolicRegexNodeKind.BOLAnchor: 1953case SymbolicRegexNodeKind.EOLAnchor: 1956case SymbolicRegexNodeKind.EndAnchorZ: 1960case SymbolicRegexNodeKind.EndAnchorZReverse: 1964case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 1969case SymbolicRegexNodeKind.Epsilon: 1970case SymbolicRegexNodeKind.Singleton: 1971case SymbolicRegexNodeKind.BoundaryAnchor: 1972case SymbolicRegexNodeKind.NonBoundaryAnchor: 1987case SymbolicRegexNodeKind.Loop: 1990case SymbolicRegexNodeKind.Concat: 1994case SymbolicRegexNodeKind.Alternate: 1998case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 2008private static TSet ComputeStartSet(SymbolicRegexBuilder<TSet> builder, SymbolicRegexNodeKind kind, SymbolicRegexNode<TSet>? left, SymbolicRegexNode<TSet>? right) 2012Debug.Assert(kind != SymbolicRegexNodeKind.Singleton); 2017case SymbolicRegexNodeKind.Epsilon: 2018case SymbolicRegexNodeKind.FixedLengthMarker: 2019case SymbolicRegexNodeKind.EndAnchor: 2020case SymbolicRegexNodeKind.BeginningAnchor: 2021case SymbolicRegexNodeKind.BoundaryAnchor: 2022case SymbolicRegexNodeKind.NonBoundaryAnchor: 2023case SymbolicRegexNodeKind.EOLAnchor: 2024case SymbolicRegexNodeKind.EndAnchorZ: 2025case SymbolicRegexNodeKind.EndAnchorZReverse: 2026case SymbolicRegexNodeKind.BOLAnchor: 2027case SymbolicRegexNodeKind.CaptureStart: 2028case SymbolicRegexNodeKind.CaptureEnd: 2031case SymbolicRegexNodeKind.Loop: 2035case SymbolicRegexNodeKind.Concat: 2039case SymbolicRegexNodeKind.Alternate: 2043case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 2044case SymbolicRegexNodeKind.Effect: 2092case SymbolicRegexNodeKind.BeginningAnchor: 2097case SymbolicRegexNodeKind.EndAnchorZReverse: 2102case SymbolicRegexNodeKind.BoundaryAnchor: 2109case SymbolicRegexNodeKind.NonBoundaryAnchor: 2116case SymbolicRegexNodeKind.Loop: 2123case SymbolicRegexNodeKind.Concat: 2135case SymbolicRegexNodeKind.Alternate: 2147case SymbolicRegexNodeKind.Effect: 2156case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 2187case SymbolicRegexNodeKind.FixedLengthMarker: 2190case SymbolicRegexNodeKind.Alternate: 2204case SymbolicRegexNodeKind.Concat: 2214/// A <see cref="SymbolicRegexNodeKind.DisableBacktrackingSimulation"/> node on the top level will be unwrapped 2222case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 2225Debug.Assert(_left._kind is not SymbolicRegexNodeKind.DisableBacktrackingSimulation); 2232case SymbolicRegexNodeKind.Alternate: 2235while (current._kind is SymbolicRegexNodeKind.Alternate) 2238Debug.Assert(current._left._kind is not SymbolicRegexNodeKind.Alternate); 2282case SymbolicRegexNodeKind.Singleton: 2285case SymbolicRegexNodeKind.Concat: 2286case SymbolicRegexNodeKind.Alternate: 2291case SymbolicRegexNodeKind.Loop: 2316case SymbolicRegexNodeKind.DisableBacktrackingSimulation: 2317case SymbolicRegexNodeKind.Effect: