Replaced rune-slice parameters with string parameters in functions; avoids unnecessary conversion from strings to rune-slices
This commit is contained in:
@@ -97,7 +97,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
||||
|
||||
// Increment until we hit a character matching the start state (assuming not 0-state)
|
||||
if start.isEmpty == false {
|
||||
for i < len(str) && !start.contentContains([]rune(str), i) {
|
||||
for i < len(str) && !start.contentContains(str, i) {
|
||||
i++
|
||||
}
|
||||
startIdx = i
|
||||
@@ -136,7 +136,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
||||
numStatesMatched := 0 // The number of states which had at least 1 match for this round
|
||||
assertionFailed := false // Whether or not an assertion failed for this round
|
||||
for _, state := range currentStates {
|
||||
matches, numMatches := state.matchesFor([]rune(str), i)
|
||||
matches, numMatches := state.matchesFor(str, i)
|
||||
if numMatches > 0 {
|
||||
numStatesMatched++
|
||||
tempStates = append(tempStates, matches...)
|
||||
@@ -211,7 +211,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset
|
||||
// Only add the match if the start index is in bounds. If the state has an assertion,
|
||||
// make sure the assertion checks out.
|
||||
if state.isLast && startIdx < len(str) {
|
||||
if state.assert == NONE || state.checkAssertion([]rune(str), len(str)) {
|
||||
if state.assert == NONE || state.checkAssertion(str, len(str)) {
|
||||
endIdx = i
|
||||
tempIndices, _ = unique_append(tempIndices, matchIndex{startIdx, endIdx})
|
||||
}
|
||||
|
Reference in New Issue
Block a user