Safe Haskell | None |
---|---|
Language | Haskell2010 |
Text.Regex.TDFA.QuasiQuoter.Internal
Contents
Description
Internal definitions for Text.Regex.TDFA.QuasiQuoter. Expect these definitions to change.
- data Flag
- = CaseSensitive { }
- | Multiline { }
- | RightAssoc { }
- | NewSyntax { }
- | LastStarGreedy { }
- | CaptureGroups { }
- data Options = Options {
- caseSensitive :: Bool
- multiline :: Bool
- rightAssoc :: Bool
- newSyntax :: Bool
- lastStarGreedy :: Bool
- captureGroups :: Bool
- unescape :: String -> String
- compilePattern :: String -> Either String (Pattern, (GroupIndex, DoPa))
- defaultOptions :: Options
- optionsToTDFAOptions :: Options -> (CompOption, ExecOption)
- applyFlag :: Flag -> Options -> Options
- flagsChars :: [(Char, Flag)]
- charToFlag :: Char -> Maybe Flag
- flagToChar :: Flag -> Char
- negateFlag :: Flag -> Flag
- parseFlags :: String -> Either String [Flag]
- switch :: Either a b -> Either b a
- flagStringToOptions :: String -> Either String Options
Documentation
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.
Constructors
CaseSensitive | |
Multiline | |
RightAssoc | |
NewSyntax | |
LastStarGreedy | |
CaptureGroups | |
Options to use when compiling a regular expression string.
Refer to CompOption
and
ExecOption
for the meanings of each option.
Constructors
Options | |
Fields
|
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.
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.
flagStringToOptions :: String -> Either String Options Source #
Apply all flags to the default options. See parseFlags
and
applyFlag
.