From ea01f1689c2cf52b10d572586f955d5a458d7377 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Mon, 6 Oct 2025 11:58:03 +0100 Subject: [PATCH] fix bug in search-list.sml: when we find a match, we should start 1 idx after the end position of the match --- fcore/search-list/search-list.sml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fcore/search-list/search-list.sml b/fcore/search-list/search-list.sml index e723417..e309f7f 100644 --- a/fcore/search-list/search-list.sml +++ b/fcore/search-list/search-list.sml @@ -136,17 +136,12 @@ struct let val searchList = PersistentVector.append (startPos, prevFinalPos, searchList) + + (* we start 1 idx after the final position we found *) + val newStart = prevFinalPos + 1 in rangeLoop - ( dfa - , bufferPos + 1 - , buffer - , finishIdx - , searchList - , 0 - , bufferPos + 1 - , ~1 - ) + (dfa, newStart, buffer, finishIdx, searchList, 0, newStart, ~1) end else (* continue searching for match *)