started getRead
This commit is contained in:
parent
55d002a4e7
commit
28fb6ccc86
1 changed files with 13 additions and 1 deletions
|
@ -198,7 +198,7 @@ invAcc a i ('[':t) = invAcc a (i+1 + g) (drop g t) -- TODO check reads in f
|
|||
invAcc a i s@(c:t) = let writeAcc = getWrite i s
|
||||
matchLen = (length $ (\(v,_,_) -> v) (fromJust 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 TODO check for reads here
|
||||
else invAcc (a ++ [fromJust writeAcc]) (i+1+matchLen) (drop matchLen t) -- assignment in accumStr, advance offset to end
|
||||
invAcc a _ _ = map (\(_,s,_) -> s) a
|
||||
|
||||
|
@ -208,6 +208,18 @@ getWrite offset s = ((Tdfa.matchOnceText §~ "^(\\**[[:word:]]+)[[:blank:]]*=")
|
|||
let m = match ! 1 -- extract the match group (0 = the whole match)
|
||||
in Just (fst m, (offset+(fst (snd m)), offset+(length (fst m))), False)
|
||||
|
||||
getRead :: Int -> String -> Maybe (String, Slice)
|
||||
getRead offset s = ((Tdfa.matchOnceText §~ "^(\\**[[:word:]]+)") s) >>= matchToString
|
||||
where matchToString (before, match, after) =
|
||||
let m = match ! 1 -- extract the match group (0 = the whole match)
|
||||
in Just (fst m, (offset+(fst (snd m)), offset+(length (fst m))))
|
||||
|
||||
isUnassigned :: String -> [(String,Slice,Bool)] -> Bool
|
||||
isUnassigned s = null . filter (\(t,_,_) -> t == s)
|
||||
|
||||
markRead :: String -> [(String,Slice,Bool)] -> [(String,Slice,Bool)]
|
||||
--markRead s a =
|
||||
|
||||
enterBlock :: [(String,Slice,Bool)] -> [(String,Slice,Bool)]
|
||||
enterBlock = map (\(v,s,b) -> ('*':v,s,b))
|
||||
|
||||
|
|
Loading…
Reference in a new issue