formatting

This commit is contained in:
2025-07-20 16:57:22 +01:00
parent 41ca612ca1
commit 33474fb5ae

View File

@@ -109,32 +109,35 @@ struct
end) end)
structure EndOfPrevWord = structure EndOfPrevWord =
MakePrevDfaLoop ( MakePrevDfaLoop
struct (struct
val startState = startState val startState = startState
fun fStart (idx, absIdx, str, tl, currentState, counter) = fun fStart (idx, absIdx, str, tl, currentState, counter) =
if idx < 0 then if idx < 0 then
case tl of case tl of
str :: tl => fStart (String.size str - 1, absIdx, str, tl, currentState, counter) str :: tl =>
| [] => 0 fStart
else (String.size str - 1, absIdx, str, tl, currentState, counter)
let | [] => 0
val chr = String.sub (str, idx) else
val newState = next (currentState, chr) let
in val chr = String.sub (str, idx)
if newState = alphaToPunct orelse newState = punctToAlpha val newState = next (currentState, chr)
orelse newState = spaceToAlpha orelse newState = spaceToPunct in
then if
if counter - 1 = 0 then newState = alphaToPunct orelse newState = punctToAlpha
absIdx orelse newState = spaceToAlpha orelse newState = spaceToPunct
else then
fStart (idx - 1, absIdx - 1, str, tl, startState, counter - 1) if counter - 1 = 0 then
else absIdx
fStart (idx - 1, absIdx - 1, str, tl, newState, counter) else
end fStart
end (idx - 1, absIdx - 1, str, tl, startState, counter - 1)
) else
fStart (idx - 1, absIdx - 1, str, tl, newState, counter)
end
end)
(* w *) (* w *)
val startOfNextWord = StartOfNextWord.next val startOfNextWord = StartOfNextWord.next