regex-tdfa-quasiquoter-0.2.0.0: Quasi-quoter for TDFA (extended POSIX) regular expressions.

Safe HaskellNone
LanguageHaskell2010

Text.Regex.TDFA.QuasiQuoter.Internal

Description

Internal definitions for Text.Regex.TDFA.QuasiQuoter. Expect these definitions to change.

Synopsis

Documentation

data Flag Source

A flag indicates whether a particular option should be True ("on") or False ("off") when compiling a regular expression string.

Refer to CompOption and ExecOption for the meanings of each flag.

Instances

data Options Source

Options to use when compiling a regular expression string.

Refer to CompOption and ExecOption for the meanings of each option.

unescape :: String -> String Source

Replaces escape sequences with their respective characters. Any sequence not listed will be left as-is.

Sequence  | Character
----------+--------------------
\\        | \
\n        | Newline
\r        | Carriage return
\t        | Horizontal tab
\f        | Form feed
\v        | Vertical tab
\xFFFF    | Code point (in hex)
|~]       | |]
\|~]      | |~]

Note that if you are reading the source file and not the generated Haddock documentation that the backslashes have been doubled up. This is also why the table is incorrectly formatted in source.

compilePattern :: String -> Either String (Pattern, (GroupIndex, DoPa)) Source

The AST for the regular expression string. If there is a parse error a corresponding error string is returned.

defaultOptions :: Options Source

The default options used when compiling a regular expression string.

Refer to CompOption and ExecOption for the meanings of each option.

optionsToTDFAOptions :: Options -> (CompOption, ExecOption) Source

Converts this module's representation of regular expression string compiler options to that of Text.Regex.TDFA's.

applyFlag :: Flag -> Options -> Options Source

Overrides the option indicated by the flag.

flagsChars :: [(Char, Flag)] Source

A relation of flags and characters. Each flag is related with one character and that character is unique. Not all characters are related to a flag.

charToFlag :: Char -> Maybe Flag Source

The flag related to the character (by flagsChars), if any.

flagToChar :: Flag -> Char Source

The character related to the flag (by flagsChars).

negateFlag :: Flag -> Flag Source

The flag which indicates the opposite option. That is, if the flag indicates an option to be True ("on") then the negated flag indicates the same option to be False ("off") and vice versa.

parseFlags :: String -> Either String [Flag] Source

The set of flags related to the set of characters using the relation flagsChars.

  • No character may occur twice.
  • If a character is present the character related to the negated flag must not be.
  • All characters must be related to a flag.

If one of these conditions are not met then a corresponding error message is returned instead.

switch :: Either a b -> Either b a Source

The switch of Left and Right for an Either value.

flagStringToOptions :: String -> Either String Options Source

Apply all flags to the default options. See parseFlags and applyFlag.