You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some more cleanup to regex NonBacktracking (#104766)
* Rent object[] rather than (uint,uint)[][] from the ArrayPool
* Remove unnecessary TInputReader generic from functions
* Add more comments and do some renames
* Remove unused TFindOptimizationsHandler from FindEndPositionDeltasNFA
* Fix a stray input reader
* Some more renames
* Avoid duplicated reads of input character and nullability info
* Remove initialStateId from TryFindNextStartingPosition and make initial accelerators more similar
* Remove unused initialStatePos / initialStatePosCandidate
It's only ever written and not actually used for anything.
* Remove unnecessary generic args and remove resulting dead code
Multiple XxDfa / XxNfa methods took a TStateHandler, but it was only ever DfaStateHandler for XxDfa or NfaStateHandler for XxNfa. We can just use the types directly in those methods, rather than generically parameterizing. Doing that revealed all but one of the members of IStateHandler weren't needed on the interface. And removing those revealed a bunch of dead code on DfaStateHandler/NfaStateHandler, which were removed, as well as arguments to some methods that weren't used.
* Put GetStateFlags back in IStateHandler and use it to avoid duplication at call sites
* Put out argument last in TryCreateNewTransition
* Store state to local in FindStartPositionDeltasDFA
* Merge IAcceleratedStateHandler into IInitialStateHandler
* Remove MintermClassifier.IntLookup
Copy file name to clipboardExpand all lines: src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/MintermClassifier.cs
+13-14Lines changed: 13 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -47,8 +47,11 @@ public MintermClassifier(BDD[] minterms)
47
47
// in order to size the lookup array to minimize steady-state memory consumption of the potentially
48
48
// large lookup array. We prefer to use the byte[] _lookup when possible, in order to keep memory
49
49
// consumption to a minimum; doing so accomodates up to 255 minterms, which is the vast majority case.
50
-
// However, when there are more than 255 minterms, we need to use int[] _intLookup.
Copy file name to clipboardExpand all lines: src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexMatcher.Automata.cs
Copy file name to clipboardExpand all lines: src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexMatcher.Explore.cs
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -35,16 +35,22 @@ public override void Explore(bool includeDotStarred, bool includeReverse, bool i
35
35
{
36
36
// Don't dequeue yet, because a transition might fail
37
37
MatchingState<TSet>state=toExplore.Peek();
38
+
38
39
// Include the special minterm for the last end-of-line if the state is sensitive to it
Copy file name to clipboardExpand all lines: src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Symbolic/SymbolicRegexMatcher.Sample.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ public override IEnumerable<string> SampleMatches(int k, int randomseed)
71
71
NfaMatchingStatestates=new();
72
72
// Here one could also consider previous characters for example for \b, \B, and ^ anchors
0 commit comments