Restored old behavior with end-of-string - new one didn't seem to work well
This commit is contained in:
@@ -29,11 +29,8 @@ func findAllMatches(start *State, str string) (indices []matchIndex) {
|
|||||||
return findAllMatchesHelper(start, str, make([]matchIndex, 0), 0)
|
return findAllMatchesHelper(start, str, make([]matchIndex, 0), 0)
|
||||||
}
|
}
|
||||||
func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset int) []matchIndex {
|
func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset int) []matchIndex {
|
||||||
// 'Base case' - exit if string is empty. If the starting state is a last-state, then append the final set of indices (trailing whitespace)
|
// 'Base case' - exit if string is empty.
|
||||||
if len(str) == 0 {
|
if len(str) == 0 {
|
||||||
if start.isLast {
|
|
||||||
indices = append(indices, matchIndex{offset, offset + 1})
|
|
||||||
}
|
|
||||||
return indices
|
return indices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user