Implement PCRE Matching (prefer left-branch) #2
@@ -287,7 +287,9 @@ func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups in
|
|||||||
if currentState.isLast {
|
if currentState.isLast {
|
||||||
currentState.threadGroups[0].EndIdx = idx
|
currentState.threadGroups[0].EndIdx = idx
|
||||||
match = append([]Group{}, currentState.threadGroups...)
|
match = append([]Group{}, currentState.threadGroups...)
|
||||||
|
if !preferLongest {
|
||||||
break
|
break
|
||||||
|
}
|
||||||
} else if !currentState.isAlternation && !currentState.isKleene && !currentState.isQuestion && !currentState.groupBegin && !currentState.groupEnd && currentState.assert == noneAssert { // Normal character
|
} else if !currentState.isAlternation && !currentState.isKleene && !currentState.isQuestion && !currentState.groupBegin && !currentState.groupEnd && currentState.assert == noneAssert { // Normal character
|
||||||
if currentState.contentContains(str, idx, preferLongest) {
|
if currentState.contentContains(str, idx, preferLongest) {
|
||||||
nextStates = addStateToList(str, idx+1, nextStates, *currentState.next, currentState.threadGroups, nil, preferLongest)
|
nextStates = addStateToList(str, idx+1, nextStates, *currentState.next, currentState.threadGroups, nil, preferLongest)
|
||||||
|
Reference in New Issue
Block a user