{- copyright (c) sreservoir.
   license bsd three-clause. -}

module Text.Regex.Less.RERtOpts (reRtOpts,RERtOpt(..)) where

import qualified Text.Regex.PCRE.Light as R

-- runtime options.
data RERtOpt = RtAnchored | RtNlAny | RtNlAnyCrLf | RtNlCr | RtNlLf
            | RtNlCrLf | RtNotBol | RtNotRtOl | RtNotEmpty | RtNoUtf8Check
            | RtPartial
  deriving (Eq,Show)

-- translates lists of runtime option constructors.
reRtOpts :: [RERtOpt] -> [R.PCREExecOption]
reRtOpts = map reRtOpt1

-- translates a runtime option constructor.
reRtOpt1 :: RERtOpt -> R.PCREExecOption
reRtOpt1 RtAnchored = R.exec_anchored
reRtOpt1 RtNlCr = R.exec_newline_cr
reRtOpt1 RtNlLf = R.exec_newline_lf
reRtOpt1 RtNlCrLf = R.exec_newline_crlf
reRtOpt1 RtNotBol = R.exec_notbol
reRtOpt1 RtNotRtOl = R.exec_noteol
reRtOpt1 RtNotEmpty = R.exec_notempty
reRtOpt1 RtNoUtf8Check = R.exec_no_utf8_check
reRtOpt1 RtPartial = R.exec_partial ;
--reRtOpt1 RtNlAny = R.exec_newline_any
--reRtOpt1 RtNlAnyCrLf = R.exec_newline_anycrlf
reRtOpt1 _                = undefined