From 1f5a36353934c0b78d2af207fceec720dcb8a8f9 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Sun, 9 Feb 2025 15:39:09 -0500 Subject: [PATCH] Use new function signatures (with preferLongest) --- regex/nfa.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/regex/nfa.go b/regex/nfa.go index db53c00..c649712 100644 --- a/regex/nfa.go +++ b/regex/nfa.go @@ -133,7 +133,7 @@ func resetThreadsHelper(state *nfaState, visitedMap map[*nfaState]bool) { // Checks if the given state's assertion is true. Returns true if the given // state doesn't have an assertion. -func (s nfaState) checkAssertion(str []rune, idx int) bool { +func (s nfaState) checkAssertion(str []rune, idx int, preferLongest bool) bool { if s.assert == alwaysTrueAssert { return true } @@ -183,7 +183,7 @@ func (s nfaState) checkAssertion(str []rune, idx int) bool { strToMatch = string(runesToMatch) } - regComp := Reg{startState, s.lookaroundNumCaptureGroups, s.lookaroundRegex} + regComp := Reg{startState, s.lookaroundNumCaptureGroups, s.lookaroundRegex, preferLongest} matchIndices := regComp.FindAll(strToMatch) numMatchesFound := 0 @@ -210,9 +210,9 @@ func (s nfaState) checkAssertion(str []rune, idx int) bool { } // Returns true if the contents of 's' contain the value at the given index of the given string -func (s nfaState) contentContains(str []rune, idx int) bool { +func (s nfaState) contentContains(str []rune, idx int, preferLongest bool) bool { if s.assert != noneAssert { - return s.checkAssertion(str, idx) + return s.checkAssertion(str, idx, preferLongest) } if idx >= len(str) { return false