Reset threads when findAllSubmatchHelper is called
This commit is contained in:
@@ -113,7 +113,7 @@ func zeroMatchPossible(str []rune, idx int, numGroups int, states ...*nfaState)
|
|||||||
num_appended := 0 // number of unique states addded to tempstates
|
num_appended := 0 // number of unique states addded to tempstates
|
||||||
for isZero == true {
|
for isZero == true {
|
||||||
zeroStates, isZero = takeZeroState(tempstates, numGroups, idx)
|
zeroStates, isZero = takeZeroState(tempstates, numGroups, idx)
|
||||||
tempstates, num_appended = unique_append(tempstates, zeroStates...)
|
tempstates, num_appended = uniqueAppend(tempstates, zeroStates...)
|
||||||
if num_appended == 0 { // break if we haven't appended any more unique values
|
if num_appended == 0 { // break if we haven't appended any more unique values
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -258,6 +258,7 @@ func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups in
|
|||||||
// The second value here shouldn't be used, because we should exit when the third return value is > than len(str)
|
// The second value here shouldn't be used, because we should exit when the third return value is > than len(str)
|
||||||
return false, []Group{}, offset
|
return false, []Group{}, offset
|
||||||
}
|
}
|
||||||
|
resetThreads(start)
|
||||||
|
|
||||||
// Hold a list of match indices for the current run. When we
|
// Hold a list of match indices for the current run. When we
|
||||||
// can no longer find a match, the match with the largest range is
|
// can no longer find a match, the match with the largest range is
|
||||||
@@ -313,13 +314,13 @@ func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups in
|
|||||||
num_appended := 0
|
num_appended := 0
|
||||||
for isZero == true {
|
for isZero == true {
|
||||||
zeroStates, isZero = takeZeroState(tempStates, numGroups, i)
|
zeroStates, isZero = takeZeroState(tempStates, numGroups, i)
|
||||||
tempStates, num_appended = unique_append(tempStates, zeroStates...)
|
tempStates, num_appended = uniqueAppend(tempStates, zeroStates...)
|
||||||
if num_appended == 0 { // Break if we haven't appended any more unique values
|
if num_appended == 0 { // Break if we haven't appended any more unique values
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentStates, _ = unique_append(currentStates, tempStates...)
|
currentStates, _ = uniqueAppend(currentStates, tempStates...)
|
||||||
tempStates = nil
|
tempStates = nil
|
||||||
|
|
||||||
// Take any transitions corresponding to current character
|
// Take any transitions corresponding to current character
|
||||||
@@ -426,7 +427,7 @@ func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups in
|
|||||||
num_appended := 0 // Number of unique states addded to tempStates
|
num_appended := 0 // Number of unique states addded to tempStates
|
||||||
for isZero == true {
|
for isZero == true {
|
||||||
zeroStates, isZero = takeZeroState(tempStates, numGroups, i)
|
zeroStates, isZero = takeZeroState(tempStates, numGroups, i)
|
||||||
tempStates, num_appended = unique_append(tempStates, zeroStates...)
|
tempStates, num_appended = uniqueAppend(tempStates, zeroStates...)
|
||||||
if num_appended == 0 { // Break if we haven't appended any more unique values
|
if num_appended == 0 { // Break if we haven't appended any more unique values
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user