|
|
|
@ -29,11 +29,8 @@ func findAllMatches(start *State, str string) (indices []matchIndex) {
|
|
|
|
|
return findAllMatchesHelper(start, str, make([]matchIndex, 0), 0)
|
|
|
|
|
}
|
|
|
|
|
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 start.isLast {
|
|
|
|
|
indices = append(indices, matchIndex{offset, offset + 1})
|
|
|
|
|
}
|
|
|
|
|
return indices
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|