getWrites

This commit is contained in:
Armin Friedl 2016-08-29 11:00:52 +02:00
parent 9dbe6c7a79
commit 8db24a3336

View file

@ -212,6 +212,13 @@ getWrite offset accumStr = ((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+(fst (snd m))+(snd (snd m))), False)
getWrites :: CheckString -> [(String, Slice, Bool)]
getWrites s = matchToAs $ (Tdfa.matchAllText §~ "(\\**[[:word:]]+)[[:blank:]]*=") s
where matchToAs (match: mts) =
let m = match ! 1 -- extract the match group (0 = the whole match)
in (fst m, (fst (snd m), (fst (snd m))+(snd (snd m))), False): matchToAs mts
matchToAs _ = []
enterBlock :: [(String,Slice,Bool)] -> [(String,Slice,Bool)]
enterBlock = map (\(v,s,b) -> ('*':v,s,b))