Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype MacroID = MacroID {
- getMacroID :: String
- data RegexType
- mkTDFA :: TestBenchMatcher -> RegexType
- mkPCRE :: TestBenchMatcher -> RegexType
- isTDFA :: RegexType -> Bool
- isPCRE :: RegexType -> Bool
- presentRegexType :: RegexType -> String
- type MacroEnv = HashMap MacroID MacroDescriptor
- data WithCaptures
- data MacroDescriptor = MacroDescriptor {
- macroSource :: !RegexSource
- macroSamples :: ![String]
- macroCounterSamples :: ![String]
- macroTestResults :: ![TestResult]
- macroParser :: !(Maybe FunctionID)
- macroDescription :: !String
- newtype TestResult = TestResult {}
- newtype RegexSource = RegexSource {}
- newtype FunctionID = FunctionID {}
- mkMacros :: (Monad m, Functor m) => (String -> m r) -> RegexType -> WithCaptures -> MacroEnv -> m (Macros r)
- testMacroEnv :: String -> RegexType -> MacroEnv -> IO Bool
- badMacros :: MacroEnv -> [MacroID]
- runTests :: (Eq a, Show a) => RegexType -> (String -> Maybe a) -> [(String, a)] -> MacroEnv -> MacroID -> MacroDescriptor -> MacroDescriptor
- runTests' :: (Eq a, Show a) => RegexType -> (Match String -> Maybe a) -> [(String, a)] -> MacroEnv -> MacroID -> MacroDescriptor -> MacroDescriptor
- formatMacroTable :: RegexType -> MacroEnv -> String
- formatMacroSummary :: RegexType -> MacroEnv -> MacroID -> String
- formatMacroSources :: RegexType -> WithCaptures -> MacroEnv -> String
- formatMacroSource :: RegexType -> WithCaptures -> MacroEnv -> MacroID -> String
- testMacroDescriptors :: [MacroDescriptor] -> [TestResult]
- mdRegexSource :: RegexType -> WithCaptures -> MacroEnv -> MacroDescriptor -> String
Documentation
MacroID
is just a wrapped String
type with an IsString
instance
presentRegexType :: RegexType -> String Source #
type MacroEnv = HashMap MacroID MacroDescriptor Source #
each macro can reference others, the whole environment being required for each macro, so we use a Lazy HashMap
data WithCaptures Source #
do we need the captures in the RE or whould they be stripped out where possible
InclCaptures | include all captures |
ExclCaptures | remove captures where possible |
data MacroDescriptor Source #
describes a macro, giving the text of the RE and a si=ummary description
MacroDescriptor | |
|
newtype TestResult Source #
list of failures on a validation run
newtype RegexSource Source #
a RE that should work for POSIX and PCRE with open brackets ('(') represented as follows: ( mere symbol (?: used for grouping only, not for captures (}: used for captures only, not for grouping (]: used for captures and grouping ( do not modify
newtype FunctionID Source #
name of the Haskell parser function for parsing the text matched by a macro
mkMacros :: (Monad m, Functor m) => (String -> m r) -> RegexType -> WithCaptures -> MacroEnv -> m (Macros r) Source #
construct a macro table suitable for use with the RE compilers
testMacroEnv :: String -> RegexType -> MacroEnv -> IO Bool Source #
test that a MacroEnv is passing all of its built-in tests
runTests :: (Eq a, Show a) => RegexType -> (String -> Maybe a) -> [(String, a)] -> MacroEnv -> MacroID -> MacroDescriptor -> MacroDescriptor Source #
runTests' :: (Eq a, Show a) => RegexType -> (Match String -> Maybe a) -> [(String, a)] -> MacroEnv -> MacroID -> MacroDescriptor -> MacroDescriptor Source #
formatMacroTable :: RegexType -> MacroEnv -> String Source #
format a macros table as a markdown table
formatMacroSummary :: RegexType -> MacroEnv -> MacroID -> String Source #
generate a plain text summary of a macro
formatMacroSources :: RegexType -> WithCaptures -> MacroEnv -> String Source #
list the source REs for each macro in plain text
formatMacroSource :: RegexType -> WithCaptures -> MacroEnv -> MacroID -> String Source #
list the source of a single macro in plain text
testMacroDescriptors :: [MacroDescriptor] -> [TestResult] Source #
mdRegexSource :: RegexType -> WithCaptures -> MacroEnv -> MacroDescriptor -> String Source #