fix backtracking bug in 'Nfa.getMatchesInRange' (we were passing the wrong value instead of 'strIdx' in the recursive call to the loop function)

This commit is contained in:
2025-09-29 13:13:14 +01:00
parent b6720ed5f1
commit 7dc94632d6
2 changed files with 13 additions and 7 deletions

View File

@@ -238,9 +238,14 @@ struct
| [] => empty
end
fun buildRange (buffer, searchString, finish) =
fun buildRange (buffer, searchString, finishIdx) =
if String.size searchString > 0 then
searchRange (buffer, searchString, finish)
let
val nfa = Nfa.parse searchString
val startIdx = #idx buffer
in
Nfa.getMatchesInRange (startIdx, finishIdx, buffer : LineGap.t, nfa)
end
else
empty