a hairy dynamically-typed function used with the legacy (=~) and (=~~) to see if it can/should add the capture names extracted from the RE into the polymorphic result of the operator (it does for any Match or Matches type, provided it is parameterised over a recognised type). The test suite is all over this one, testing all of these cases.
Moduleregex-1.1.0.2Haskell2010
Text.RE.ZeInternals
Contents
Synopsis
- value addCaptureNames
- value addCaptureNamesToMatches
- value addCaptureNamesToMatch
- value escapeREString
- value cp
- value extractNamedCaptures
- value idFormatTokenREOptions
- data Token
- value validToken
- value formatTokens
- value formatTokens'
- value formatTokens0
- value scan
- value expandMacros
- data PreludeMacro
- value presentPreludeMacro
- value preludeMacros
- value preludeMacroTable
- value preludeMacroSummary
- value preludeMacroSources
- value preludeMacroSource
- value preludeMacroEnv
- value unsafeCompileSearchReplace_
- value compileSearchReplace_
- value compileSearchAndReplace_
- data QQFailure
- value qq0
- value mkTDFA
- value mkPCRE
- value badMacros
- Packageregex-1.1.0.2
- Exports30
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceAddCaptureNames.hs
The regex Internal Modules
This module contains just what the test suite (re-tests) in regex-examples needs from the package internals to do its job and the ZeInternals types and functions needed by the regex-with-pcre package
Text.RE.ZeInternals.AddCaptureNames
a convenience function used by the API modules to insert capture names extracted from the parsed RE into the (*=~) result
a convenience function used by the API modules to insert capture names extracted from the parsed RE into the (?=~) result
Text.RE.ZeInternals.EscapeREString
Convert a string into a regular expression that will match that string
Text.RE.ZeInternals.NamedCaptures
quasi quoter for CaptureID: [cp|0|], [cp|0|], etc.,
indexing captures by classic positional numbers, and [cp|foo|],
etc., referencing a named capture [re| ... ${foo}( ... ) ... |].
extract the CaptureNames from an RE or return an error diagnostic if the RE is not well formed; also returns the total number of captures in the RE
a configuration that will preserve the parsed regular expression in the output
our RE scanner returns a list of these tokens
Instances4Eq, Show, Generic, Rep
Eq TokenDefined in regex-1.1.0.2 · Text.RE.ZeInternals.NamedCapturesShow TokenDefined in regex-1.1.0.2 · Text.RE.ZeInternals.NamedCapturesGeneric TokenDefined in regex-1.1.0.2 · Text.RE.ZeInternals.NamedCapturestype Rep Token = D1 ('MetaDataDefined in regex-1.1.0.2 · Text.RE.ZeInternals.NamedCaptures"Token"
"Text.RE.ZeInternals.NamedCaptures"
"regex-1.1.0.2-2at7PcFFSC222FFX1OYJ6g"
'False) ((C1 ('MetaCons"ECap"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))) :+: (C1 ('MetaCons"PGrp"
'PrefixI 'False) U1 :+: C1 ('MetaCons"PCap"
'PrefixI 'False) U1)) :+: (C1 ('MetaCons"Bra"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"BS"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)) :+: C1 ('MetaCons"Other"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)))))
check that a token is well formed
format [Token] into an RE string
the general Token formatter, generating REs according to the options
scan a RE string into a list of RE Token
Text.RE.ZeInternals.Replace
expand all of the @{..} macros in the RE in the argument String according to the Macros argument, preprocessing the RE String according to the Mode argument (used internally)
Text.RE.ZeInternals.PreludeMacros
an enumeration of all of the prelude macros
Instances5Bounded, Enum, Eq, Ord, Show
Bounded PreludeMacroDefined in regex-1.1.0.2 · Text.RE.ZeInternals.PreludeMacrosEnum PreludeMacroDefined in regex-1.1.0.2 · Text.RE.ZeInternals.PreludeMacrosEq PreludeMacroDefined in regex-1.1.0.2 · Text.RE.ZeInternals.PreludeMacrosOrd PreludeMacroDefined in regex-1.1.0.2 · Text.RE.ZeInternals.PreludeMacrosShow PreludeMacroDefined in regex-1.1.0.2 · Text.RE.ZeInternals.PreludeMacros
naming the macros
generate the standard prelude Macros used to parse REs
format the standard prelude macros in a markdown table
generate a textual summary of the prelude macros
generate a plain text table giving the RE for each macro with all macros expanded (to NF)
generate plain text giving the expanded RE for a single macro
generate the MacroEnv for the standard prelude macros
Text.RE.ZeInternals.SearchReplace
warapper on compileSearchReplace_ that will generate an error if any compilation errors are found
compile a SearchReplace template generating errors if the RE or the template are not well formed -- all capture references being checked
compile SearcgReplace from two strings containing the RE
and the replacement template
Text.RE.ZeInternals.QQ
used to throw an exception reporting an abuse of a quasi quoter
Constructors
QQFailure_qqf_context :: Stringin what context was the quasi quoter used
_qqf_component :: Stringhow was the quasi quoter being abused
a quasi quoter that can be used in no context (to be extended with the appropriate quasi quoter parser)