fix
This commit is contained in:
parent
f372e1f144
commit
ebf4dafaf3
1 changed files with 2 additions and 4 deletions
|
@ -196,9 +196,10 @@ invAcc a i ('[':t) = invAcc a (i+1 + g) (drop g t) -- TODO check reads in f
|
||||||
-- if it is not found add its slice to the result
|
-- if it is not found add its slice to the result
|
||||||
-- all variables with false at the end of a block are unused
|
-- all variables with false at the end of a block are unused
|
||||||
invAcc a i s@(c:t) = let writeAcc = getWrite i s
|
invAcc a i s@(c:t) = let writeAcc = getWrite i s
|
||||||
|
matchLen = (length $ (\(v,_,_) -> v) (fromJust writeAcc))
|
||||||
in if isNothing writeAcc
|
in if isNothing writeAcc
|
||||||
then invAcc a (i+1) t -- no assignment in rest str
|
then invAcc a (i+1) t -- no assignment in rest str
|
||||||
else invAcc (a ++ [fromJust writeAcc]) (i+1+(length $ (\(v,_,_) -> v) (fromJust writeAcc))) t -- assignment in accumStr, advance offset to end
|
else invAcc (a ++ [fromJust writeAcc]) (i+1+matchLen) (drop matchLen t) -- assignment in accumStr, advance offset to end
|
||||||
invAcc a _ _ = map (\(_,s,_) -> s) a
|
invAcc a _ _ = map (\(_,s,_) -> s) a
|
||||||
|
|
||||||
getWrite :: Int -> String -> Maybe (String, Slice, Bool)
|
getWrite :: Int -> String -> Maybe (String, Slice, Bool)
|
||||||
|
@ -207,9 +208,6 @@ getWrite offset s = ((Tdfa.matchOnceText §~ "^(\\**[[:word:]]+)[[:blank:]]*=")
|
||||||
let m = match ! 1 -- extract the match group (0 = the whole match)
|
let m = match ! 1 -- extract the match group (0 = the whole match)
|
||||||
in Just (fst m, (offset+(fst (snd m)), offset+(fst (snd m))+(snd (snd m))), False)
|
in Just (fst m, (offset+(fst (snd m)), offset+(fst (snd m))+(snd (snd m))), False)
|
||||||
|
|
||||||
fst3 :: (a,b,c) -> a
|
|
||||||
fst3 (a,b,c) = a
|
|
||||||
|
|
||||||
enterBlock :: [(String,Slice,Bool)] -> [(String,Slice,Bool)]
|
enterBlock :: [(String,Slice,Bool)] -> [(String,Slice,Bool)]
|
||||||
enterBlock = map (\(v,s,b) -> ('*':v,s,b))
|
enterBlock = map (\(v,s,b) -> ('*':v,s,b))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue