leaveBlock done
This commit is contained in:
parent
5d696eaf8d
commit
c82c4dc85d
1 changed files with 9 additions and 2 deletions
|
@ -186,7 +186,7 @@ invalidAccesses = invAcc [] "" 0
|
||||||
-- :: CurrentAssignments -> AccumulatorString -> GlobalIndex
|
-- :: CurrentAssignments -> AccumulatorString -> GlobalIndex
|
||||||
invAcc :: [(String,Slice,Bool)] -> String -> Int -> CheckString -> Slices
|
invAcc :: [(String,Slice,Bool)] -> String -> Int -> CheckString -> Slices
|
||||||
invAcc a accumStr i ('{':t) = invAcc (enterBlock a) "" (i+1+(length accumStr)) t
|
invAcc a accumStr i ('{':t) = invAcc (enterBlock a) "" (i+1+(length accumStr)) t
|
||||||
invAcc a accumStr i ('}':t) = invAcc (leaveBlock a) "" (i+1+(length accumStr)) t
|
invAcc a accumStr i ('}':t) = getUnread a ++ invAcc (leaveBlock a) "" (i+1+(length accumStr)) t
|
||||||
invAcc a accumStr i ('[':t) = invAcc a accumStr (i+1 + g) (drop g t) -- TODO check reads in first part
|
invAcc a accumStr i ('[':t) = invAcc a accumStr (i+1 + g) (drop g t) -- TODO check reads in first part
|
||||||
where g = fromJust (elemIndex ':' t)
|
where g = fromJust (elemIndex ':' t)
|
||||||
-- when reading an assignment :word: =
|
-- when reading an assignment :word: =
|
||||||
|
@ -218,7 +218,14 @@ enterBlock = map (\(v,s,b) -> ('*':v,s,b))
|
||||||
-- remove 1 * from each variable name
|
-- remove 1 * from each variable name
|
||||||
-- if it cannot be removed, remove the variable
|
-- if it cannot be removed, remove the variable
|
||||||
leaveBlock :: [(String,Slice,Bool)] -> [(String,Slice,Bool)]
|
leaveBlock :: [(String,Slice,Bool)] -> [(String,Slice,Bool)]
|
||||||
leaveBlock a = a
|
leaveBlock = map (\(v,s,b) -> (tail v,s,b)) . filter (\(v,_,_) -> head v == '*')
|
||||||
|
|
||||||
|
-- add all unread assignments to the result slices
|
||||||
|
getUnread :: [(String,Slice,Bool)] -> Slices
|
||||||
|
getUnread [] = []
|
||||||
|
getUnread ((v,s,b):ss)
|
||||||
|
| b = getUnread ss
|
||||||
|
| otherwise = s:getUnread ss
|
||||||
|
|
||||||
{- General Fontification Utilities -}
|
{- General Fontification Utilities -}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue