diff --git a/src/App/Fontifier.hs b/src/App/Fontifier.hs index b4ece6b..c2440c2 100644 --- a/src/App/Fontifier.hs +++ b/src/App/Fontifier.hs @@ -205,10 +205,10 @@ invAcc a i s@(c:t) = let writeAcc = getWrite i s then if isNothing readAcc then invAcc a (i+1) t else if isUnassigned (fromJust readAcc) a -- no assignment in rest str - then (snd (fromJust readAcc)) : (invAcc a (i+1+readLen) (drop readLen t)) - else invAcc (markRead (fromJust readAcc) a) (i+1+readLen) (drop readLen t) - else invAcc (a ++ [fromJust writeAcc]) (i+1+matchLen) (drop matchLen t) -- assignment in accumStr, advance offset to end -invAcc a _ _ = [] + then (snd (fromJust readAcc)) : (invAcc a (i+readLen) (drop readLen s)) + else invAcc (markRead (fromJust readAcc) a) (i+readLen) (drop readLen s) + else invAcc (a ++ [fromJust writeAcc]) (i+matchLen) (drop matchLen s) -- assignment in accumStr, advance offset to end +invAcc _ _ _ = [] getWrite :: Int -> String -> Maybe (String, Slice, Bool) getWrite offset s = ((Tdfa.matchOnceText ยง~ "^(\\**[[:word:]]+)[[:blank:]]*=") s) >>= matchToA