|
|
@ -150,7 +150,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
|
|
|
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
|
|
|
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if assertionFailed && numStatesMatched == 0 { // Nothing has matched and an assertion has failed - bort
|
|
|
|
if assertionFailed && numStatesMatched == 0 { // Nothing has matched and an assertion has failed - abort
|
|
|
|
if i == startingFrom {
|
|
|
|
if i == startingFrom {
|
|
|
|
i++
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -208,10 +208,13 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
|
|
|
tempStates = nil
|
|
|
|
tempStates = nil
|
|
|
|
|
|
|
|
|
|
|
|
for _, state := range currentStates {
|
|
|
|
for _, state := range currentStates {
|
|
|
|
// Only add the match if the start index is in bounds
|
|
|
|
// Only add the match if the start index is in bounds. If the state has an assertion,
|
|
|
|
|
|
|
|
// make sure the assertion checks out.
|
|
|
|
if state.isLast && startIdx < len(str) {
|
|
|
|
if state.isLast && startIdx < len(str) {
|
|
|
|
endIdx = i
|
|
|
|
if state.assert == NONE || state.checkAssertion([]rune(str), len(str)) {
|
|
|
|
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
|
|
|
endIdx = i
|
|
|
|
|
|
|
|
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Get the maximum index-range from the list
|
|
|
|
// Get the maximum index-range from the list
|
|
|
|