fix bug in 'Nfa.getMatches' loop function: when we find that this state is valid, continue loop from 'finishIdx + 1'.
This commit is contained in:
@@ -149,13 +149,18 @@ struct
|
|||||||
in
|
in
|
||||||
case state of
|
case state of
|
||||||
VALID finishIdx =>
|
VALID finishIdx =>
|
||||||
let val acc = PersistentVector.append (pos, finishIdx, acc)
|
let
|
||||||
in loop (finishIdx, str, origNfa, origNfa, finishIdx, acc)
|
val acc = PersistentVector.append (startPos, finishIdx, acc)
|
||||||
|
in
|
||||||
|
loop
|
||||||
|
(finishIdx + 1, str, origNfa, origNfa, finishIdx + 1, acc)
|
||||||
end
|
end
|
||||||
| INVALID =>
|
| INVALID =>
|
||||||
(* backtrack to another position in the string
|
(* backtrack to another position in the string
|
||||||
* to see if the NFA matches that portion of the string *)
|
* to see if the NFA matches that portion of the string *)
|
||||||
loop (startPos + 1, str, origNfa, origNfa, startPos + 1, acc)
|
let val pos = startPos + 1
|
||||||
|
in loop (pos, str, origNfa, origNfa, pos, acc)
|
||||||
|
end
|
||||||
| UNTESTED => loop (pos + 1, str, nfa, origNfa, startPos, acc)
|
| UNTESTED => loop (pos + 1, str, nfa, origNfa, startPos, acc)
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
|
|||||||
Reference in New Issue
Block a user