module Text.Regex.TDFA.Wrap(Regex(..),CompOption(..),ExecOption(..),(=~),(=~~)) where
import Text.Regex.Base.RegexLike(RegexMaker(..),RegexOptions(..),RegexContext(..))
import Text.Regex.TDFA.Common(CompOption(..),ExecOption(..),Regex(..))
instance RegexOptions Regex CompOption ExecOption where
blankCompOpt = defaultCompOpt
blankExecOpt = defaultExecOpt
defaultCompOpt = CompOption { caseSensitive = True
, multiline = True
, rightAssoc = True
, lastStarGreedy = False
}
defaultExecOpt = ExecOption { captureGroups = True
, testMatch = False
}
setExecOpts e r = r {regex_execOptions=e}
getExecOpts r = regex_execOptions r
(=~) :: (RegexMaker Regex CompOption ExecOption source,RegexContext Regex source1 target)
=> source1 -> source -> target
(=~) x r = let make :: RegexMaker Regex CompOption ExecOption a => a -> Regex
make = makeRegex
in match (make r) x
(=~~) :: (RegexMaker Regex CompOption ExecOption source,RegexContext Regex source1 target,Monad m)
=> source1 -> source -> m target
(=~~) x r = do let make :: (RegexMaker Regex CompOption ExecOption a, Monad m) => a -> m Regex
make = makeRegexM
q <- make r
matchM q x