almost done functorising character iterators for vi word
This commit is contained in:
@@ -130,41 +130,32 @@ struct
|
|||||||
val fStart = Folder.foldPrev
|
val fStart = Folder.foldPrev
|
||||||
end)
|
end)
|
||||||
|
|
||||||
fun startOfCurrentWord (idx, absIdx, str, tl, currentState, counter) =
|
structure StartOfCurrentWordFolder =
|
||||||
if idx < 0 then
|
MakeCharFolderPrev
|
||||||
case tl of
|
(struct
|
||||||
str :: tl =>
|
val startState = startState
|
||||||
startOfCurrentWord
|
val tables = tables
|
||||||
(String.size str - 1, absIdx, str, tl, currentState, counter)
|
|
||||||
| [] => 0
|
fun isFinal currentState =
|
||||||
else
|
currentState = alphaToSpace orelse currentState = punctToSpace
|
||||||
let
|
orelse currentState = alphaToPunct orelse currentState = punctToAlpha
|
||||||
val chr = String.sub (str, idx) handle _ => (print "156\n"; raise Empty)
|
|
||||||
val newState =
|
fun finish idx = idx + 1
|
||||||
next (currentState, chr)
|
end)
|
||||||
handle _ =>
|
|
||||||
(print ("158: " ^ Word8.toString currentState ^ "\n"); raise Empty)
|
|
||||||
in
|
|
||||||
if
|
|
||||||
newState = alphaToSpace orelse newState = punctToSpace
|
|
||||||
orelse newState = alphaToPunct orelse newState = punctToAlpha
|
|
||||||
then
|
|
||||||
if counter - 1 = 0 then
|
|
||||||
absIdx + 1
|
|
||||||
else
|
|
||||||
startOfCurrentWord
|
|
||||||
(idx - 1, absIdx - 1, str, tl, startState, counter - 1)
|
|
||||||
else
|
|
||||||
startOfCurrentWord (idx - 1, absIdx - 1, str, tl, newState, counter)
|
|
||||||
end
|
|
||||||
|
|
||||||
structure StartOfCurrentWord =
|
structure StartOfCurrentWord =
|
||||||
MakePrevDfaLoopMinus1
|
MakePrevDfaLoopMinus1
|
||||||
(struct val startState = startState val fStart = startOfCurrentWord end)
|
(struct
|
||||||
|
val startState = startState
|
||||||
|
val fStart = StartOfCurrentWordFolder.foldPrev
|
||||||
|
end)
|
||||||
|
|
||||||
structure StartOfCurrentWordStrict =
|
structure StartOfCurrentWordStrict =
|
||||||
MakePrevDfaLoop
|
MakePrevDfaLoop
|
||||||
(struct val startState = startState val fStart = startOfCurrentWord end)
|
(struct
|
||||||
|
val startState = startState
|
||||||
|
val fStart = StartOfCurrentWordFolder.foldPrev
|
||||||
|
end)
|
||||||
|
|
||||||
fun endOfCurrentWord (idx, absIdx, str, tl, currentState, counter) =
|
fun endOfCurrentWord (idx, absIdx, str, tl, currentState, counter) =
|
||||||
if idx = String.size str then
|
if idx = String.size str then
|
||||||
|
|||||||
Reference in New Issue
Block a user