fixed offset after matches

This commit is contained in:
Johannes Winklehner 2016-08-29 13:16:22 +02:00
parent 1e62767b87
commit 380ed86ccf

View file

@ -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