|
|
@ -31,6 +31,10 @@ func findAllMatches(start *State, str string) (indices []matchIndex) {
|
|
|
|
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.
|
|
|
|
// 'Base case' - exit if string is empty.
|
|
|
|
if len(str) == 0 {
|
|
|
|
if len(str) == 0 {
|
|
|
|
|
|
|
|
// If the start is a Kleene star, then it should also match an empty string.
|
|
|
|
|
|
|
|
if start.isKleene {
|
|
|
|
|
|
|
|
indices = append(indices, matchIndex{offset, offset})
|
|
|
|
|
|
|
|
}
|
|
|
|
return indices
|
|
|
|
return indices
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|