fixed multiline
This commit is contained in:
parent
acf48765ff
commit
077b5a3f37
1 changed files with 16 additions and 2 deletions
|
@ -228,16 +228,30 @@ getReads i s@(c:ss)
|
|||
where v = getRead i s
|
||||
|
||||
getWrite :: Int -> String -> Maybe (String, Slice, Bool)
|
||||
getWrite offset s = ((Tdfa.matchOnceText §~ "^(\\**[[:word:]]+)[[:blank:]]*=") s) >>= matchToA
|
||||
getWrite offset s = ((Tdfa.matchOnceText regex) s) >>= matchToA
|
||||
where matchToA (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))), False)
|
||||
regex = Tdfa.makeRegexOpts compOpt Tdfa.defaultExecOpt "^(\\**[[:word:]]+)[[:blank:]]*="
|
||||
compOpt = Tdfa.CompOption { Tdfa.caseSensitive = True
|
||||
, Tdfa.multiline = False
|
||||
, Tdfa.rightAssoc = True
|
||||
, Tdfa.newSyntax = True
|
||||
, Tdfa.lastStarGreedy = False
|
||||
}
|
||||
|
||||
getRead :: Int -> String -> Maybe (String, Slice)
|
||||
getRead offset s = ((Tdfa.matchOnceText §~ "^(\\**[[:word:]]+)") s) >>= matchToString
|
||||
getRead offset s = ((Tdfa.matchOnceText regex) 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))))
|
||||
regex = Tdfa.makeRegexOpts compOpt Tdfa.defaultExecOpt "^(\\**[[:word:]]+)"
|
||||
compOpt = Tdfa.CompOption { Tdfa.caseSensitive = True
|
||||
, Tdfa.multiline = False
|
||||
, Tdfa.rightAssoc = True
|
||||
, Tdfa.newSyntax = True
|
||||
, Tdfa.lastStarGreedy = False
|
||||
}
|
||||
|
||||
isUnassigned :: (String,Slice) -> [(String,Slice,Bool)] -> Bool
|
||||
isUnassigned (s,_) = null . filter (\(t,_,_) -> t == s)
|
||||
|
|
Loading…
Reference in a new issue