|
|
@ -97,7 +97,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
|
|
|
|
|
|
|
|
|
|
|
// Increment until we hit a character matching the start state (assuming not 0-state)
|
|
|
|
// Increment until we hit a character matching the start state (assuming not 0-state)
|
|
|
|
if start.isEmpty == false {
|
|
|
|
if start.isEmpty == false {
|
|
|
|
for i < len(str) && !start.contentContains([]rune(str), i) {
|
|
|
|
for i < len(str) && !start.contentContains(str, i) {
|
|
|
|
i++
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
startIdx = i
|
|
|
|
startIdx = i
|
|
|
@ -136,7 +136,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
|
|
|
numStatesMatched := 0 // The number of states which had at least 1 match for this round
|
|
|
|
numStatesMatched := 0 // The number of states which had at least 1 match for this round
|
|
|
|
assertionFailed := false // Whether or not an assertion failed for this round
|
|
|
|
assertionFailed := false // Whether or not an assertion failed for this round
|
|
|
|
for _, state := range currentStates {
|
|
|
|
for _, state := range currentStates {
|
|
|
|
matches, numMatches := state.matchesFor([]rune(str), i)
|
|
|
|
matches, numMatches := state.matchesFor(str, i)
|
|
|
|
if numMatches > 0 {
|
|
|
|
if numMatches > 0 {
|
|
|
|
numStatesMatched++
|
|
|
|
numStatesMatched++
|
|
|
|
tempStates = append(tempStates, matches...)
|
|
|
|
tempStates = append(tempStates, matches...)
|
|
|
@ -211,7 +211,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
|
|
|
// Only add the match if the start index is in bounds. If the state has an assertion,
|
|
|
|
// Only add the match if the start index is in bounds. If the state has an assertion,
|
|
|
|
// make sure the assertion checks out.
|
|
|
|
// make sure the assertion checks out.
|
|
|
|
if state.isLast && startIdx < len(str) {
|
|
|
|
if state.isLast && startIdx < len(str) {
|
|
|
|
if state.assert == NONE || state.checkAssertion([]rune(str), len(str)) {
|
|
|
|
if state.assert == NONE || state.checkAssertion(str, len(str)) {
|
|
|
|
endIdx = i
|
|
|
|
endIdx = i
|
|
|
|
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
|
|
|
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
|
|
|
}
|
|
|
|
}
|
|
|
|