Restored old behavior with end-of-string - new one didn't seem to work well

master
Aadhavan Srinivasan 2 months ago
parent 956bdbdcb6
commit c9fdf5aa6c

@ -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
}

Loading…
Cancel
Save