done functorising character iterators for vi word
This commit is contained in:
@@ -157,37 +157,32 @@ struct
|
|||||||
val fStart = StartOfCurrentWordFolder.foldPrev
|
val fStart = StartOfCurrentWordFolder.foldPrev
|
||||||
end)
|
end)
|
||||||
|
|
||||||
fun endOfCurrentWord (idx, absIdx, str, tl, currentState, counter) =
|
structure EndOfCurrentWordFolder =
|
||||||
if idx = String.size str then
|
MakeCharFolderNext
|
||||||
case tl of
|
(struct
|
||||||
str :: tl =>
|
val startState = startState
|
||||||
endOfCurrentWord (0, absIdx, str, tl, currentState, counter)
|
val tables = tables
|
||||||
| [] => Int.max (0, absIdx - 2)
|
|
||||||
else
|
fun isFinal currentState =
|
||||||
let
|
currentState = alphaToSpace orelse currentState = punctToSpace
|
||||||
val chr = String.sub (str, idx)
|
orelse currentState = alphaToPunct orelse currentState = punctToAlpha
|
||||||
val newState = next (currentState, chr)
|
|
||||||
in
|
fun finish x = x - 1
|
||||||
if
|
end)
|
||||||
newState = alphaToSpace orelse newState = punctToSpace
|
|
||||||
orelse newState = alphaToPunct orelse newState = punctToAlpha
|
|
||||||
then
|
|
||||||
if counter - 1 = 0 then
|
|
||||||
absIdx - 1
|
|
||||||
else
|
|
||||||
endOfCurrentWord
|
|
||||||
(idx + 1, absIdx + 1, str, tl, startState, counter - 1)
|
|
||||||
else
|
|
||||||
endOfCurrentWord (idx + 1, absIdx + 1, str, tl, newState, counter)
|
|
||||||
end
|
|
||||||
|
|
||||||
structure EndOfCurrentWord =
|
structure EndOfCurrentWord =
|
||||||
MakeNextDfaLoopPlus1
|
MakeNextDfaLoopPlus1
|
||||||
(struct val startState = startState val fStart = endOfCurrentWord end)
|
(struct
|
||||||
|
val startState = startState
|
||||||
|
val fStart = EndOfCurrentWordFolder.foldNext
|
||||||
|
end)
|
||||||
|
|
||||||
structure EndOfCurrentWordStrict =
|
structure EndOfCurrentWordStrict =
|
||||||
MakeNextDfaLoop
|
MakeNextDfaLoop
|
||||||
(struct val startState = startState val fStart = endOfCurrentWord end)
|
(struct
|
||||||
|
val startState = startState
|
||||||
|
val fStart = EndOfCurrentWordFolder.foldNext
|
||||||
|
end)
|
||||||
|
|
||||||
(* w *)
|
(* w *)
|
||||||
val startOfNextWord = StartOfNextWord.next
|
val startOfNextWord = StartOfNextWord.next
|
||||||
|
|||||||
Reference in New Issue
Block a user