Renamed 'findAllMatchesHelper' to 'findAllSubmatchHelper'

master
Aadhavan Srinivasan 2 days ago
parent 8eda5055ff
commit b685d2fd5f

@ -168,7 +168,7 @@ func FindNthMatch(regex Reg, str string, n int) (Match, error) {
var matchFound bool
var matchIdx Match
for idx <= len(str_runes) {
matchFound, matchIdx, idx = findAllMatchesHelper(regex.start, str_runes, idx, regex.numGroups)
matchFound, matchIdx, idx = findAllSubmatchHelper(regex.start, str_runes, idx, regex.numGroups)
if matchFound {
matchNum++
}
@ -198,7 +198,7 @@ func (regex Reg) FindAllSubmatch(str string) []Match {
var matchIdx Match
indices := make([]Match, 0)
for idx <= len(str_runes) {
matchFound, matchIdx, idx = findAllMatchesHelper(regex.start, str_runes, idx, regex.numGroups)
matchFound, matchIdx, idx = findAllSubmatchHelper(regex.start, str_runes, idx, regex.numGroups)
if matchFound {
indices = append(indices, matchIdx)
}
@ -215,7 +215,7 @@ func (regex Reg) FindAllSubmatch(str string) []Match {
// the next search should start from.
//
// Might return duplicates or overlapping indices, so care must be taken to prune the resulting array.
func findAllMatchesHelper(start *nfaState, str []rune, offset int, numGroups int) (bool, Match, int) {
func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups int) (bool, Match, int) {
// Base case - exit if offset exceeds string's length
if offset > len(str) {
// The second value here shouldn't be used, because we should exit when the third return value is > than len(str)

Loading…
Cancel
Save