File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,13 +14,14 @@ class Nfa extends RegexpPattern {
1414 int tryMatch (String input, int start, int end) {
1515 var result = - 1 ;
1616 var currentStates = < NfaState > {};
17+ var nextStates = < NfaState > {};
1718 _addStates (this .start, currentStates);
1819 if (currentStates.any ((state) => state.isEnd)) {
1920 result = start;
2021 }
2122 for (var i = start; i < end; i++ ) {
2223 final value = input.codeUnitAt (i);
23- final nextStates = < NfaState > {} ;
24+ nextStates. clear () ;
2425 for (final state in currentStates) {
2526 final nextState = state.transitions[value];
2627 if (nextState != null ) {
@@ -33,7 +34,7 @@ class Nfa extends RegexpPattern {
3334 if (nextStates.isEmpty) {
3435 break ;
3536 }
36- currentStates = nextStates;
37+ ( currentStates, nextStates) = ( nextStates, currentStates) ;
3738 if (currentStates.any ((state) => state.isEnd)) {
3839 result = i + 1 ;
3940 }
You can’t perform that action at this time.
0 commit comments