regex 1.0.1.4 → 1.0.1.5
raw patch · 6 files changed
+72/−24 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +2/−1
- Text/RE/ZeInternals/NamedCaptures.lhs +1/−1
- Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs +1/−1
- Text/RE/ZeInternals/TDFA.hs +63/−19
- changelog +3/−0
- regex.cabal +2/−2
README.md view
@@ -39,7 +39,8 @@ - [X] 2017-06-04 v1.0.1.1 [Fix 1.0.1.0 release bug and provisionally fix UTF8/PCRE interworking](https://github.com/iconnect/regex/milestone/20) - [X] 2017-06-05 v1.0.1.2 [Permit utf8-string-1](https://github.com/iconnect/regex/milestone/21) - [X] 2017-06-05 v1.0.1.3 [Suspend Windows tests for PCRE on UTF-8 text](https://github.com/iconnect/regex/milestone/22)-- [ ] 2017-08-31 v2.0.0.0 [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4)+- [X] 2018-12-14 v1.0.1.4 [Fix for GHC 8.4.4, GHC-8.6.2](https://github.com/iconnect/regex/milestone/23)+- [X] 2018-12-18 v1.0.1.5 [TDFA quasi quoters not dealing with \n, etc.](https://github.com/iconnect/regex/milestone/24) See the [Roadmap page](http://roadmap.regex.uk) for details.
Text/RE/ZeInternals/NamedCaptures.lhs view
@@ -127,7 +127,7 @@ , mk "\\(\\?" $ const PCap , mk "\\(" $ const Bra , mk "\\\\(.)" $ BS . s2c . x_1- , mk "(.)" $ Other . s2c . x_1+ , mk "(.|\n)" $ Other . s2c . x_1 ] x_1 = captureText $ IsCaptureOrdinal $ CaptureOrdinal 1
Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs view
@@ -55,4 +55,4 @@ -> String -> SearchReplace RE s unsafe_compile_sr os =- unsafeCompileSearchReplace_ packR $ compileRegexWithOptions os+ unsafeCompileSearchReplace_ packR $ compileRegexWithOptionsForQQ os
Text/RE/ZeInternals/TDFA.hs view
@@ -35,6 +35,7 @@ , compileRegex , compileRegexWith , compileRegexWithOptions+ , compileRegexWithOptionsForQQ -- * Compiling Search-Replace Templates , compileSearchReplace , compileSearchReplaceWith@@ -194,9 +195,17 @@ => o -> String -> m RE-compileRegexWithOptions = compileRegex_ . makeREOptions+compileRegexWithOptions = compileRegex_ RPM_raw . makeREOptions +-- | compile a 'String' into a 'RE' for q quasi quoter, using the given+-- @SimpleREOptions@, generating an error if the RE is not well formed+compileRegexWithOptionsForQQ :: (IsOption o, Functor m, Monad m)+ => o+ -> String+ -> m RE+compileRegexWithOptionsForQQ = compileRegex_ RPM_qq . makeREOptions + ------------------------------------------------------------------------ -- Compiling Search Replace Templates ------------------------------------------------------------------------@@ -273,7 +282,7 @@ prelude :: Macros RE prelude = runIdentity $ preludeMacros mk regexType ExclCaptures where- mk = Identity . unsafeCompileRegex_ noPreludeREOptions+ mk = Identity . unsafeCompileRegex_ RPM_raw noPreludeREOptions -- | the standard 'MacroEnv' for this back end (see "Text.RE.TestBench") preludeEnv :: MacroEnv@@ -373,12 +382,17 @@ } where parse :: SimpleREOptions -> (String->Q Exp) -> String -> Q Exp- parse sro mk rs = either error (\_->mk rs) $ compileRegex_ os rs+ parse sro mk rs = either error (\_->mk rs) $ compileRegex_ RPM_qq os rs where os = unpackSimpleREOptions sro +data RegexParseMode+ = RPM_qq+ | RPM_raw+ deriving (Eq,Show)+ unsafeCompileRegexSimple :: SimpleREOptions -> String -> RE-unsafeCompileRegexSimple sro re_s = unsafeCompileRegex_ os re_s+unsafeCompileRegexSimple sro re_s = unsafeCompileRegex_ RPM_qq os re_s where os = unpackSimpleREOptions sro @@ -386,28 +400,19 @@ => o -> String -> RE-unsafeCompileRegex = unsafeCompileRegex_ . makeREOptions+unsafeCompileRegex = unsafeCompileRegex_ RPM_qq . makeREOptions -unsafeCompileRegex_ :: REOptions -> String -> RE-unsafeCompileRegex_ os = either oops id . compileRegex_ os+unsafeCompileRegex_ :: RegexParseMode -> REOptions -> String -> RE+unsafeCompileRegex_ rpm os = either oops id . compileRegex_ rpm os where oops = error . ("unsafeCompileRegex: " ++) -compileRegex' :: (Functor m,Monad m)- => REOptions- -> String- -> m (CaptureNames,Regex)-compileRegex' REOptions{..} s0 = do- ((_,cnms),s2) <- either fail return $ extractNamedCaptures s1- (,) cnms <$> makeRegexOptsM optionsComp optionsExec s2- where- s1 = expandMacros reSource optionsMacs s0- compileRegex_ :: (Functor m,Monad m)- => REOptions+ => RegexParseMode+ -> REOptions -> String -> m RE-compileRegex_ os re_s = uncurry mk <$> compileRegex' os re_s+compileRegex_ rpm os re_s = uncurry mk <$> compileRegex' rpm os re_s where mk cnms rx = RE@@ -416,6 +421,45 @@ , _re_cnames = cnms , _re_regex = rx }++compileRegex' :: (Functor m,Monad m)+ => RegexParseMode+ -> REOptions+ -> String+ -> m (CaptureNames,Regex)+compileRegex' rpm REOptions{..} s0 = do+ ((_,cnms),s2) <- either fail return $ extractNamedCaptures s1+ (,) cnms <$> makeRegexOptsM optionsComp optionsExec s2+ where+ s1 = expandMacros reSource optionsMacs $ pp s0++ pp = case rpm of+ RPM_qq -> qq_prep+ RPM_raw -> id+++------------------------------------------------------------------------+-- Preprocessing Literal REs+------------------------------------------------------------------------++qq_prep :: String -> String+qq_prep s0 = case s0 of+ "" -> ""+ c:s -> case c of+ '\\' -> backslash s+ _ -> c : qq_prep s+ where+ backslash s1 = case s1 of+ "" -> "\\"+ c:s -> case c of+ 'a' -> '\a' : qq_prep s+ 'b' -> '\b' : qq_prep s+ 'f' -> '\f' : qq_prep s+ 'n' -> '\n' : qq_prep s+ 'r' -> '\r' : qq_prep s+ 't' -> '\t' : qq_prep s+ 'v' -> '\v' : qq_prep s+ _ -> '\\': c : qq_prep s ------------------------------------------------------------------------
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +1.0.1.5 Chris Dornan <chris.dornan@irisconnect.co.uk> 2018-12-18+ * TDFA quasi quoters not dealing with \n, etc. (#157)+ 1.0.1.4 Chris Dornan <chris.dornan@irisconnect.co.uk> 2018-12-14 * GHC-8.4.4, GHC-8.6.2 (#160)
regex.cabal view
@@ -1,5 +1,5 @@ Name: regex-Version: 1.0.1.4+Version: 1.0.1.5 Synopsis: Toolkit for regex-base Description: A regular expression toolkit for regex-base with compile-time checking of RE syntax, data types for@@ -32,7 +32,7 @@ Source-Repository this Type: git Location: https://github.com/iconnect/regex.git- Tag: 1.0.1.4+ Tag: 1.0.1.5