regex-posix 0.96.0.0 → 0.96.0.1
raw patch · 8 files changed
+117/−77 lines, 8 filesdep ~basedep ~bytestringdep ~containersnew-uploader
Dependency ranges changed: base, bytestring, containers
Files
- ChangeLog.md +18/−4
- regex-posix.cabal +40/−14
- src/Text/Regex/Posix.hs +3/−3
- src/Text/Regex/Posix/ByteString.hs +7/−7
- src/Text/Regex/Posix/ByteString/Lazy.hs +5/−5
- src/Text/Regex/Posix/Sequence.hs +16/−16
- src/Text/Regex/Posix/String.hs +10/−10
- src/Text/Regex/Posix/Wrap.hsc +18/−18
ChangeLog.md view
@@ -1,9 +1,23 @@-See also http://pvp.haskell.org/faq+For versioning policy, see: http://pvp.haskell.org/faq -## 0.96.0.0+## 0.96.0.1 (2021-07-19) +- Compatibility with `base-4.16` (GHC 9.2)+- Fix stack installation problems on Windows around flag `_regex-posix-clib`+ (issues+ [#4](https://github.com/haskell-hvr/regex-posix/issues/4) and+ [#7](https://github.com/haskell-hvr/regex-posix/issues/7)).++## 0.96.0.0 Revision 2 (2021-02-20)++- Compatibility with `base-4.15` (GHC 9.0)++## 0.96.0.0 Revision 1 (2020-03-25)++- Compatibility with `base-4.14` (GHC 8.10)++## 0.96.0.0 (2019-09-30)+ - Update to `regex-base-0.94.0.0` API - Compatibility with `base-4.13.0` - Remove internal regex C implementation------
regex-posix.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 name: regex-posix-version: 0.96.0.0+version: 0.96.0.1 build-type: Simple license: BSD3 license-file: LICENSE copyright: Copyright (c) 2007-2010, Christopher Kuklewicz author: Christopher Kuklewicz-maintainer: hvr@gnu.org+maintainer: hvr@gnu.org, Andreas Abel bug-reports: https://github.com/hvr/regex-posix synopsis: POSIX Backend for "Text.Regex" (regex-base) category: Text@@ -22,14 +22,35 @@ ChangeLog.md cbits/myfree.h +tested-with:+ -- Haskell CI:+ GHC == 7.0.4+ GHC == 7.2.2+ GHC == 7.4.2+ GHC == 7.6.3+ GHC == 7.8.4+ GHC == 7.10.3+ GHC == 8.0.2+ GHC == 8.2.2+ GHC == 8.4.4+ GHC == 8.6.5+ GHC == 8.8.4+ GHC == 8.10.4+ GHC == 9.0.1+ source-repository head type: git location: https://github.com/hvr/regex-posix.git +source-repository this+ type: git+ location: https://github.com/hvr/regex-base.git+ tag: v0.96.0.1+ flag _regex-posix-clib manual: False default: False- description: Use <//hackage.haskell.org/package/regex-posix-clib regex-posix-clib> package+ description: Use <//hackage.haskell.org/package/regex-posix-clib regex-posix-clib> package (used by default on Windows) library hs-source-dirs: src@@ -47,13 +68,10 @@ c-sources: cbits/myfree.c include-dirs: cbits - if flag(_regex-posix-clib)+ if flag(_regex-posix-clib) || os(windows) build-depends: regex-posix-clib == 2.7.*- else- -- use POSIX.2 regex implementation from @libc@- -- However, Windows/msys2 doesn't provide a POSIX.2 regex impl in its @libc@- if os(windows)- build-depends: base<0+ -- Otherwise, use POSIX.2 regex implementation from @libc@.+ -- However, Windows/msys2 doesn't provide a POSIX.2 regex impl in its @libc@. default-language: Haskell2010 default-extensions:@@ -63,16 +81,24 @@ GeneralizedNewtypeDeriving FlexibleContexts TypeSynonymInstances+ -- ^ for ghc 7.0, subsumed under FlexibleInstances later FlexibleInstances build-depends: regex-base == 0.94.*- , base >= 4.3 && < 4.14+ , base >= 4.3 && < 4.17 , containers >= 0.4 && < 0.7- , bytestring >= 0.9 && < 0.11+ , bytestring >= 0.9 && < 0.12 , array >= 0.3 && < 0.6 - if !impl(ghc >= 8)+ if impl(ghc < 8) build-depends: fail == 4.9.* - ghc-options: -O2- -Wall -fno-warn-unused-imports+ -- Warnings++ ghc-options:+ -Wall+ -fno-warn-unused-imports++ if impl(ghc >= 8)+ ghc-options:+ -Wcompat
src/Text/Regex/Posix.hs view
@@ -3,10 +3,10 @@ -- -- Module : Text.Regex.Posix -- Copyright : (c) Chris Kuklewicz 2006--- SPDX-License-Identifier: BSD-3-Clause+-- License : BSD-3-Clause ----- Maintainer : hvr@gnu.org--- Stability : experimental+-- Maintainer : hvr@gnu.org, Andreas Abel+-- Stability : stable -- Portability : non-portable (regex-base needs MPTC+FD) -- -- Module that provides the Regex backend that wraps the
src/Text/Regex/Posix/ByteString.hs view
@@ -3,10 +3,10 @@ -- | -- Module : Text.Regex.Posix.ByteString -- Copyright : (c) Chris Kuklewicz 2006--- SPDX-License-Identifier: BSD-3-Clause--- --- Maintainer : hvr@gnu.org--- Stability : experimental+-- License : BSD-3-Clause+--+-- Maintainer : hvr@gnu.org, Andreas Abel+-- Stability : stable -- Portability : non-portable (regex-base needs MPTC+FD) -- -- This provides 'ByteString' instances for RegexMaker and RegexLike@@ -81,7 +81,7 @@ instance RegexLike Regex ByteString where matchTest regex bs = unsafePerformIO $ asCString bs (wrapTest regex) >>= unwrap- matchOnce regex bs = unsafePerformIO $ + matchOnce regex bs = unsafePerformIO $ execute regex bs >>= unwrap matchAll regex bs = unsafePerformIO $ asCString bs (wrapMatchAll regex) >>= unwrap@@ -115,7 +115,7 @@ case maybeStartEnd of Right Nothing -> return (Right Nothing) -- Right (Just []) -> ...- Right (Just parts) -> + Right (Just parts) -> return . Right . Just . listArray (0,pred (length parts)) . map (\(s,e)->(fromIntegral s, fromIntegral (e-s))) $ parts Left err -> return (Left err)@@ -127,7 +127,7 @@ let getSub (start,stop) | start == unusedRegOffset = B.empty | otherwise = B.take (fi (stop-start)) . B.drop (fi start) $ bs matchedParts [] = (B.empty,B.empty,bs,[]) -- no information- matchedParts (matchedStartStop@(start,stop):subStartStop) = + matchedParts (matchedStartStop@(start,stop):subStartStop) = (B.take (fi start) bs ,getSub matchedStartStop ,B.drop (fi stop) bs
src/Text/Regex/Posix/ByteString/Lazy.hs view
@@ -3,10 +3,10 @@ -- | -- Module : Text.Regex.Posix.ByteString.Lazy -- Copyright : (c) Chris Kuklewicz 2007--- SPDX-License-Identifier: BSD-3-Clause--- --- Maintainer : hvr@gnu.org--- Stability : experimental+-- License : BSD-3-Clause+--+-- Maintainer : hvr@gnu.org, Andreas Abel+-- Stability : stable -- Portability : non-portable (regex-base needs MPTC+FD) -- -- This provides 'ByteString.Lazy' instances for RegexMaker and RegexLike@@ -93,7 +93,7 @@ instance RegexLike Regex L.ByteString where matchTest regex bs = unsafePerformIO $ asCString bs (wrapTest regex) >>= unwrap- matchOnce regex bs = unsafePerformIO $ + matchOnce regex bs = unsafePerformIO $ execute regex bs >>= unwrap matchAll regex bs = unsafePerformIO $ asCString bs (wrapMatchAll regex) >>= unwrap
src/Text/Regex/Posix/Sequence.hs view
@@ -3,10 +3,10 @@ -- | -- Module : Text.Regex.Posix.Sequence -- Copyright : (c) Chris Kuklewicz 2006--- SPDX-License-Identifier: BSD-3-Clause--- --- Maintainer : hvr@gnu.org--- Stability : experimental+-- License : BSD-3-Clause+--+-- Maintainer : hvr@gnu.org, Andreas Abel+-- Stability : stable -- Portability : non-portable (regex-base needs MPTC+FD) -- -- This provides 'String' instances for 'RegexMaker' and 'RegexLike' based@@ -77,15 +77,15 @@ instance RegexMaker Regex CompOption ExecOption (Seq Char) where makeRegexOpts c e pattern = unsafePerformIO $ (compile c e pattern >>= unwrap)- makeRegexOptsM c e pattern = either (fail.show) return $ unsafePerformIO $ + makeRegexOptsM c e pattern = either (fail.show) return $ unsafePerformIO $ (compile c e pattern) instance RegexLike Regex (Seq Char) where matchTest regex str = unsafePerformIO $ do withSeq str (wrapTest regex) >>= unwrap- matchOnce regex str = unsafePerformIO $ + matchOnce regex str = unsafePerformIO $ execute regex str >>= unwrap- matchAll regex str = unsafePerformIO $ + matchAll regex str = unsafePerformIO $ withSeq str (wrapMatchAll regex) >>= unwrap matchCount regex str = unsafePerformIO $ withSeq str (wrapCount regex) >>= unwrap@@ -93,7 +93,7 @@ -- compile compile :: CompOption -- ^ Flags (summed together) -> ExecOption -- ^ Flags (summed together)- -> (Seq Char) -- ^ The regular expression to compile (ASCII only, no null bytes)+ -> Seq Char -- ^ The regular expression to compile (ASCII only, no null bytes) -> IO (Either WrapError Regex) -- ^ Returns: the compiled regular expression compile flags e pattern = withSeq pattern (wrapCompile flags e) @@ -102,7 +102,7 @@ -- | Matches a regular expression against a string execute :: Regex -- ^ Compiled regular expression- -> (Seq Char) -- ^ (Seq Char) to match against+ -> Seq Char -- ^ Text to match against -> IO (Either WrapError (Maybe (Array Int (MatchOffset,MatchLength)))) -- ^ Returns: 'Nothing' if the regex did not match the -- string, or:@@ -116,7 +116,7 @@ Right Nothing -> return (Right Nothing) -- Right (Just []) -> fail "got [] back!" -- return wierd array instead Right (Just parts) ->- return . Right . Just . listArray (0,pred (length parts)) + return . Right . Just . listArray (0,pred (length parts)) . map (\(s,e)->(fromIntegral s, fromIntegral (e-s))) $ parts Left err -> return (Left err)@@ -126,8 +126,8 @@ -- | Matches a regular expression against a string regexec :: Regex -- ^ Compiled regular expression- -> (Seq Char) -- ^ (Seq Char) to match against- -> IO (Either WrapError (Maybe ((Seq Char), (Seq Char), (Seq Char), [(Seq Char)])))+ -> Seq Char -- ^ Text to match against+ -> IO (Either WrapError (Maybe (Seq Char, Seq Char, Seq Char, [Seq Char]))) -- ^ Returns: 'Nothing' if the regex did not match the -- string, or: --@@ -138,13 +138,13 @@ -- subexpression matches) -- @ regexec regex str = do- let getSub :: (RegOffset,RegOffset) -> (Seq Char)+ let getSub :: (RegOffset,RegOffset) -> Seq Char getSub (start,stop) | start == unusedRegOffset = S.empty- | otherwise = + | otherwise = extract (fromEnum start,fromEnum $ stop-start) $ str- matchedParts :: [(RegOffset,RegOffset)] -> ((Seq Char), (Seq Char), (Seq Char), [(Seq Char)])+ matchedParts :: [(RegOffset,RegOffset)] -> (Seq Char, Seq Char, Seq Char, [Seq Char]) matchedParts [] = (str,S.empty,S.empty,[]) -- no information- matchedParts (matchedStartStop@(start,stop):subStartStop) = + matchedParts (matchedStartStop@(start,stop):subStartStop) = (before (fromEnum start) str ,getSub matchedStartStop ,after (fromEnum stop) str
src/Text/Regex/Posix/String.hs view
@@ -3,10 +3,10 @@ -- | -- Module : Text.Regex.Posix.String -- Copyright : (c) Chris Kuklewicz 2006--- SPDX-License-Identifier: BSD-3-Clause--- --- Maintainer : hvr@gnu.org--- Stability : experimental+-- License : BSD-3-Clause+--+-- Maintainer : hvr@gnu.org, Andreas Abel+-- Stability : stable -- Portability : non-portable (regex-base needs MPTC+FD) -- -- This provides 'String' instances for 'RegexMaker' and 'RegexLike' based@@ -73,15 +73,15 @@ instance RegexMaker Regex CompOption ExecOption String where makeRegexOpts c e pattern = unsafePerformIO $ (compile c e pattern >>= unwrap)- makeRegexOptsM c e pattern = either (fail.show) return $ unsafePerformIO $ + makeRegexOptsM c e pattern = either (fail.show) return $ unsafePerformIO $ (compile c e pattern) instance RegexLike Regex String where matchTest regex str = unsafePerformIO $ do withCAString str (wrapTest regex) >>= unwrap- matchOnce regex str = unsafePerformIO $ + matchOnce regex str = unsafePerformIO $ execute regex str >>= unwrap- matchAll regex str = unsafePerformIO $ + matchAll regex str = unsafePerformIO $ withCAString str (wrapMatchAll regex) >>= unwrap matchCount regex str = unsafePerformIO $ withCAString str (wrapCount regex) >>= unwrap@@ -112,7 +112,7 @@ Right Nothing -> return (Right Nothing) -- Right (Just []) -> fail "got [] back!" -- return wierd array instead Right (Just parts) ->- return . Right . Just . listArray (0,pred (length parts)) + return . Right . Just . listArray (0,pred (length parts)) . map (\(s,e)->(fromIntegral s, fromIntegral (e-s))) $ parts Left err -> return (Left err)@@ -135,10 +135,10 @@ -- @ regexec regex str = do let getSub (start,stop) | start == unusedRegOffset = ""- | otherwise = + | otherwise = genericTake (stop-start) . genericDrop start $ str matchedParts [] = (str,"","",[]) -- no information- matchedParts (matchedStartStop@(start,stop):subStartStop) = + matchedParts (matchedStartStop@(start,stop):subStartStop) = (genericTake start str ,getSub matchedStartStop ,genericDrop stop str
src/Text/Regex/Posix/Wrap.hsc view
@@ -4,10 +4,10 @@ -- | -- Module : Text.Regex.Posix.Wrap -- Copyright : (c) Chris Kuklewicz 2006,2007,2008 derived from (c) The University of Glasgow 2002--- SPDX-License-Identifier: BSD-3-Clause+-- Identifier : BSD-3-Clause ----- Maintainer : hvr@gnu.org--- Stability : experimental+-- Maintainer : hvr@gnu.org, Andreas Abel+-- Stability : stable -- Portability : non-portable (regex-base needs MPTC+FD) -- -- WrapPosix.hsc exports a wrapped version of the ffi imports. To@@ -23,11 +23,11 @@ -- This module will fail or error only if allocation fails or a nullPtr -- is passed in. ----- 2009-January : wrapMatchAll and wrapCount now adjust the execution--- option execNotBOL after the first result to take into account '\n'+-- 2009-January : 'wrapMatchAll' and 'wrapCount' now adjust the execution+-- option 'execNotBOL' after the first result to take into account '\n' -- in the text immediately before the next matches. (version 0.93.3) ----- 2009-January : wrapMatchAll and wrapCount have been changed to+-- 2009-January : 'wrapMatchAll' and 'wrapCount' have been changed to -- return all non-overlapping matches, including empty matches even if -- they coincide with the end of the previous non-empty match. The -- change is that the first non-empty match no longer terminates the@@ -125,17 +125,17 @@ data CRegex -- pointer tag for regex_t C type --- | RegOffset is "typedef int regoff_t" on Linux and ultimately "typedef--- long long __int64_t" on Max OS X. So rather than saying+-- | 'RegOffset' is @typedef int regoff_t@ on Linux and ultimately @typedef+-- long long __int64_t@ on Max OS X. So rather than saying -- 2,147,483,647 is all the length you need, I'll take the larger: -- 9,223,372,036,854,775,807 should be enough bytes for anyone, no -- need for Integer. The alternative is to compile to different sizes--- in a platform dependent manner with "type RegOffset = (#type--- regoff_t)", which I do not want to do.+-- in a platform dependent manner with @type RegOffset = (#type+-- regoff_t)@, which I do not want to do. ----- There is also a special value 'unusedRegOffset' :: 'RegOffset' which is+-- There is also a special value @'unusedRegOffset' :: 'RegOffset'@ which is -- (-1) and as a starting index means that the subgroup capture was--- unused. Otherwise the RegOffset indicates a character boundary that+-- unused. Otherwise the 'RegOffset' indicates a character boundary that -- is before the character at that index offset, with the first -- character at index offset 0. So starting at 1 and ending at 2 means -- to take only the second character.@@ -170,7 +170,7 @@ -- regular expressions. Option values (and their man 3 regexec names) are -- -- * 'execBlank' which is a complete zero value for all the flags. This is--- the blankExecOpt value.+-- the @blankExecOpt@ value. -- -- * 'execNotBOL' (REG_NOTBOL) can be set to prevent ^ from matching at the -- start of the input.@@ -226,7 +226,7 @@ unusedRegOffset :: RegOffset unusedRegOffset = (-1) --- | The return code will be retOk when it is the Haskell wrapper and+-- | The return code will be @retOk@ when it is the Haskell wrapper and -- not the underlying library generating the error message. type WrapError = (ReturnCode,String) @@ -238,13 +238,13 @@ wrapTest :: Regex -> CString -> IO (Either WrapError Bool) --- | wrapMatch returns offsets for the begin and end of each capture.--- Unused captures have offsets of unusedRegOffset which is (-1)+-- | 'wrapMatch' returns offsets for the begin and end of each capture.+-- Unused captures have offsets of 'unusedRegOffset' which is (-1). wrapMatch :: Regex -> CString -> IO (Either WrapError (Maybe [(RegOffset,RegOffset)])) --- | wrapMatchAll returns the offset and length of each capture.--- Unused captures have an offset of unusedRegOffset which is (-1) and+-- | 'wrapMatchAll' returns the offset and length of each capture.+-- Unused captures have an offset of 'unusedRegOffset' which is (-1) and -- length of 0. wrapMatchAll :: Regex -> CString -> IO (Either WrapError [MatchArray])