skylighting-0.1.1.5: syntax highlighting library

Safe Haskell | None
Language | Haskell2010

Skylighting.Regex

Synopsis

- data Regex :: *
- data RegexException
- data RE = RE {
  - reString :: ByteString
  - reCompiled :: Maybe Regex
  - reCaseSensitive :: Bool
  }
- compileRegex :: Bool -> ByteString -> Regex
- matchRegex :: Regex -> ByteString -> Maybe [ByteString]
- convertOctalEscapes :: String -> String

# Documentation

data Regex :: * #

A compiled regular expression

Instances

RegexOptions Regex CompOption ExecOption |
Methods blankCompOpt :: CompOption # blankExecOpt :: ExecOption # defaultCompOpt :: CompOption # defaultExecOpt :: ExecOption # setExecOpts :: ExecOption -> Regex -> Regex # getExecOpts :: Regex -> ExecOption #

data RegexException #

Instances

Show RegexException # |
Methods showsPrec :: Int -> RegexException -> ShowS # show :: RegexException -> String # showList :: [RegexException] -> ShowS #
Generic RegexException # |
Associated Types type Rep RegexException :: * -> * # Methods from :: RegexException -> Rep RegexException x # to :: Rep RegexException x -> RegexException #
Exception RegexException # |
Methods toException :: RegexException -> SomeException # fromException :: SomeException -> Maybe RegexException # displayException :: RegexException -> String #
type Rep RegexException # |
type Rep RegexException = D1 (MetaData "RegexException" "Skylighting.Regex" "skylighting-0.1.1.5-DUb9KMoRcLYLuJD7pWvWFM" True) (C1 (MetaCons "RegexException" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))

data RE #

Constructors

RE |
Fields reString :: ByteString reCompiled :: Maybe Regex reCaseSensitive :: Bool

Instances

Show RE # |
Methods showsPrec :: Int -> RE -> ShowS # show :: RE -> String # showList :: [RE] -> ShowS #

compileRegex :: Bool -> ByteString -> Regex #

Compile a PCRE regex. If the first parameter is True, the regex is case-sensitive, otherwise caseless. The regex is compiled from a bytestring interpreted as UTF-8. If the regex cannot be compiled, a `RegexException` is thrown.

matchRegex :: Regex -> ByteString -> Maybe [ByteString] #

convertOctalEscapes :: String -> String #

Convert octal escapes to the form pcre wants. Note: need at least pcre 8.34 for the form o{dddd}. So we prefer ddd or x{...}.