diff --git a/README.md b/README.md index 32cc30e..90bfb4c 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ two packages: - [X] 2017-03-29 v0.11.0.0 [Simplify the API](https://github.com/iconnect/regex/milestone/14) - [X] 2017-03-30 v0.11.1.0 [Fix the Haddocks](https://github.com/iconnect/regex/milestone/15) - [X] 2017-03-31 v0.12.0.0 [Move IsRegex into Text.RE](https://github.com/iconnect/regex/milestone/16) +- [X] 2017-04-02 v0.13.0.0 [Protect findCaptureID and add Find, re-sort-imports, tutorials](https://github.com/iconnect/regex/milestone/17) - [ ] 2017-04-03 v1.0.0.0 [First stable release](https://github.com/iconnect/regex/milestone/3) - [ ] 2017-08-31 v2.0.0.0 [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4) diff --git a/Text/RE/PCRE.hs b/Text/RE/PCRE.hs index 2ce6a03..9f71739 100644 --- a/Text/RE/PCRE.hs +++ b/Text/RE/PCRE.hs @@ -67,19 +67,19 @@ module Text.RE.PCRE ) where -import qualified Text.Regex.Base as B -import qualified Text.Regex.PCRE as PCRE import Text.RE.PCRE.ByteString() import Text.RE.PCRE.ByteString.Lazy() import Text.RE.PCRE.Sequence() import Text.RE.PCRE.String() import Text.RE.REOptions import Text.RE.ZeInternals.AddCaptureNames -import Text.RE.ZeInternals.SearchReplace.PCRE import Text.RE.ZeInternals.PCRE +import Text.RE.ZeInternals.SearchReplace.PCRE import Text.RE.ZeInternals.Types.IsRegex import Text.RE.ZeInternals.Types.Match import Text.RE.ZeInternals.Types.Matches +import qualified Text.Regex.Base as B +import qualified Text.Regex.PCRE as PCRE -- | find all the matches in the argument text; e.g., to count the number diff --git a/Text/RE/PCRE/ByteString.hs b/Text/RE/PCRE/ByteString.hs index 7e80821..33d4c37 100644 --- a/Text/RE/PCRE/ByteString.hs +++ b/Text/RE/PCRE/ByteString.hs @@ -59,14 +59,14 @@ module Text.RE.PCRE.ByteString , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString ) where -import Prelude.Compat import qualified Data.ByteString as B import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames -import Text.RE.ZeInternals.SearchReplace.PCRE.ByteString import Text.RE.ZeInternals.PCRE +import Text.RE.ZeInternals.SearchReplace.PCRE.ByteString import Text.RE.ZeInternals.Types.IsRegex import Text.Regex.Base import qualified Text.Regex.PCRE as PCRE diff --git a/Text/RE/PCRE/ByteString/Lazy.hs b/Text/RE/PCRE/ByteString/Lazy.hs index a7c836c..d697eae 100644 --- a/Text/RE/PCRE/ByteString/Lazy.hs +++ b/Text/RE/PCRE/ByteString/Lazy.hs @@ -59,14 +59,14 @@ module Text.RE.PCRE.ByteString.Lazy , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy ) where -import Prelude.Compat import qualified Data.ByteString.Lazy as LBS import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames -import Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy import Text.RE.ZeInternals.PCRE +import Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy import Text.RE.ZeInternals.Types.IsRegex import Text.Regex.Base import qualified Text.Regex.PCRE as PCRE diff --git a/Text/RE/PCRE/Sequence.hs b/Text/RE/PCRE/Sequence.hs index e914643..82d8710 100644 --- a/Text/RE/PCRE/Sequence.hs +++ b/Text/RE/PCRE/Sequence.hs @@ -59,14 +59,14 @@ module Text.RE.PCRE.Sequence , module Text.RE.ZeInternals.SearchReplace.PCRE.Sequence ) where -import Prelude.Compat import qualified Data.Sequence as S import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames -import Text.RE.ZeInternals.SearchReplace.PCRE.Sequence import Text.RE.ZeInternals.PCRE +import Text.RE.ZeInternals.SearchReplace.PCRE.Sequence import Text.RE.ZeInternals.Types.IsRegex import Text.Regex.Base import qualified Text.Regex.PCRE as PCRE diff --git a/Text/RE/PCRE/String.hs b/Text/RE/PCRE/String.hs index dc7a76d..4154829 100644 --- a/Text/RE/PCRE/String.hs +++ b/Text/RE/PCRE/String.hs @@ -59,14 +59,14 @@ module Text.RE.PCRE.String , module Text.RE.ZeInternals.SearchReplace.PCRE.String ) where -import Prelude.Compat import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames -import Text.RE.ZeInternals.SearchReplace.PCRE.String import Text.RE.ZeInternals.PCRE +import Text.RE.ZeInternals.SearchReplace.PCRE.String import Text.RE.ZeInternals.Types.IsRegex import Text.Regex.Base import qualified Text.Regex.PCRE as PCRE diff --git a/Text/RE/REOptions.lhs b/Text/RE/REOptions.lhs index c6d903c..ce98663 100644 --- a/Text/RE/REOptions.lhs +++ b/Text/RE/REOptions.lhs @@ -23,8 +23,8 @@ module Text.RE.REOptions , emptyMacros ) where -import Data.Hashable import qualified Data.HashMap.Strict as HM +import Data.Hashable import Data.String import Language.Haskell.TH import Language.Haskell.TH.Syntax diff --git a/Text/RE/TDFA/ByteString.hs b/Text/RE/TDFA/ByteString.hs index 2a8ec1c..3f78790 100644 --- a/Text/RE/TDFA/ByteString.hs +++ b/Text/RE/TDFA/ByteString.hs @@ -59,9 +59,9 @@ module Text.RE.TDFA.ByteString , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString ) where -import Prelude.Compat import qualified Data.ByteString as B import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames diff --git a/Text/RE/TDFA/ByteString/Lazy.hs b/Text/RE/TDFA/ByteString/Lazy.hs index d4144b9..e9adf06 100644 --- a/Text/RE/TDFA/ByteString/Lazy.hs +++ b/Text/RE/TDFA/ByteString/Lazy.hs @@ -59,9 +59,9 @@ module Text.RE.TDFA.ByteString.Lazy , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy ) where -import Prelude.Compat import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames diff --git a/Text/RE/TDFA/Sequence.hs b/Text/RE/TDFA/Sequence.hs index 33b4727..a0592c8 100644 --- a/Text/RE/TDFA/Sequence.hs +++ b/Text/RE/TDFA/Sequence.hs @@ -59,9 +59,9 @@ module Text.RE.TDFA.Sequence , module Text.RE.ZeInternals.SearchReplace.TDFA.Sequence ) where -import Prelude.Compat import qualified Data.Sequence as S import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames diff --git a/Text/RE/TDFA/String.hs b/Text/RE/TDFA/String.hs index 8be617a..c12bf5c 100644 --- a/Text/RE/TDFA/String.hs +++ b/Text/RE/TDFA/String.hs @@ -59,9 +59,9 @@ module Text.RE.TDFA.String , module Text.RE.ZeInternals.SearchReplace.TDFA.String ) where -import Prelude.Compat import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames diff --git a/Text/RE/TDFA/Text.hs b/Text/RE/TDFA/Text.hs index 489ede5..d880075 100644 --- a/Text/RE/TDFA/Text.hs +++ b/Text/RE/TDFA/Text.hs @@ -59,9 +59,9 @@ module Text.RE.TDFA.Text , module Text.RE.ZeInternals.SearchReplace.TDFA.Text ) where -import Prelude.Compat import qualified Data.Text as T import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames diff --git a/Text/RE/TDFA/Text/Lazy.hs b/Text/RE/TDFA/Text/Lazy.hs index 1dfbe87..30419b5 100644 --- a/Text/RE/TDFA/Text/Lazy.hs +++ b/Text/RE/TDFA/Text/Lazy.hs @@ -59,9 +59,9 @@ module Text.RE.TDFA.Text.Lazy , module Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy ) where -import Prelude.Compat import qualified Data.Text.Lazy as TL import Data.Typeable +import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.AddCaptureNames diff --git a/Text/RE/TestBench.hs b/Text/RE/TestBench.hs index 8357a8b..f833c0c 100644 --- a/Text/RE/TestBench.hs +++ b/Text/RE/TestBench.hs @@ -43,147 +43,10 @@ module Text.RE.TestBench , Severity(..) , parseSeverity , severityKeywords + -- * Text.RE + , module Text.RE ) where -import Data.Array -import qualified Data.HashMap.Strict as HM -import Data.Maybe -import qualified Data.Text as T -import Data.Time -import qualified Data.Time.Locale.Compat as LC -import Data.Word -import Text.Printf -import Text.Read -import Text.RE.Replace +import Text.RE import Text.RE.ZeInternals.TestBench - - -parseInteger :: Replace a => a -> Maybe Int -parseInteger = readMaybe . unpackR - -parseHex :: Replace a => a -> Maybe Int -parseHex = readMaybe . ("0x"++) . unpackR - -parseDouble :: Replace a => a -> Maybe Double -parseDouble = readMaybe . unpackR - -parseString :: Replace a => a -> Maybe T.Text -parseString = readMaybe . unpackR - -parseSimpleString :: Replace a => a -> Maybe T.Text -parseSimpleString = Just . T.dropEnd 1 . T.drop 1 . textifyR - -date_templates, time_templates, timezone_templates, - date_time_8601_templates, date_time_templates :: [String] -date_templates = ["%F"] -time_templates = ["%H:%M:%S","%H:%M:%S%Q","%H:%M"] -timezone_templates = ["Z","%z"] -date_time_8601_templates = - [ printf "%sT%s%s" dt tm tz - | dt <- date_templates - , tm <- time_templates - , tz <- timezone_templates - ] -date_time_templates = - [ printf "%s%c%s%s" dt sc tm tz - | dt <- date_templates - , sc <- ['T',' '] - , tm <- time_templates - , tz <- timezone_templates ++ [" UTC",""] - ] - -parseDate :: Replace a => a -> Maybe Day -parseDate = parse_time date_templates - -parseSlashesDate :: Replace a => a -> Maybe Day -parseSlashesDate = parse_time ["%Y/%m/%d"] - -parseTimeOfDay :: Replace a => a -> Maybe TimeOfDay -parseTimeOfDay = parse_time time_templates - -parseTimeZone :: Replace a => a -> Maybe TimeZone -parseTimeZone = parse_time timezone_templates - -parseDateTime :: Replace a => a -> Maybe UTCTime -parseDateTime = parse_time date_time_templates - -parseDateTime8601 :: Replace a => a -> Maybe UTCTime -parseDateTime8601 = parse_time date_time_8601_templates - -parseDateTimeCLF :: Replace a => a -> Maybe UTCTime -parseDateTimeCLF = parse_time ["%d/%b/%Y:%H:%M:%S %z"] - -parseShortMonth :: Replace a => a -> Maybe Int -parseShortMonth = flip HM.lookup short_month_hm . unpackR - -parse_time :: (ParseTime t,Replace s) => [String] -> s -> Maybe t -parse_time tpls = prs . unpackR - where - prs s = listToMaybe $ catMaybes - [ parseTime LC.defaultTimeLocale fmt s - | fmt<-tpls - ] - -short_month_hm :: HM.HashMap String Int -short_month_hm = HM.fromList [ (T.unpack $ shortMonthArray!i,i) | i<-[1..12] ] - -shortMonthArray :: Array Int T.Text -shortMonthArray = listArray (1,12) $ - T.words "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" - -type IPV4Address = (Word8,Word8,Word8,Word8) - -parseIPv4Address :: Replace a => a -> Maybe IPV4Address -parseIPv4Address = prs . words_by (=='.') . unpackR - where - prs [a_s,b_s,c_s,d_s] = do - a <- readMaybe a_s - b <- readMaybe b_s - c <- readMaybe c_s - d <- readMaybe d_s - case all is_o [a,b,c,d] of - True -> Just (toEnum a,toEnum b,toEnum c,toEnum d) - False -> Nothing - prs _ = Nothing - - is_o x = 0 <= x && x <= 255 - -data Severity - = Emerg - | Alert - | Crit - | Err - | Warning - | Notice - | Info - | Debug - deriving (Bounded,Enum,Ord,Eq,Show) - -parseSeverity :: Replace a => a -> Maybe Severity -parseSeverity = flip HM.lookup severity_hm . textifyR - -severity_hm :: HM.HashMap T.Text Severity -severity_hm = HM.fromList - [ (kw,pri) - | pri<-[minBound..maxBound] - , let (kw0,kws) = severityKeywords pri - , kw <- kw0:kws - ] - -severityKeywords :: Severity -> (T.Text,[T.Text]) -severityKeywords pri = case pri of - Emerg -> (,) "emerg" ["panic"] - Alert -> (,) "alert" [] - Crit -> (,) "crit" [] - Err -> (,) "err" ["error"] - Warning -> (,) "warning" ["warn"] - Notice -> (,) "notice" [] - Info -> (,) "info" [] - Debug -> (,) "debug" [] - -words_by :: (Char->Bool) -> String -> [String] -words_by f s = case dropWhile f s of - "" -> [] - s' -> w : words_by f s'' - where - (w, s'') = break f s' +import Text.RE.ZeInternals.TestBench.Parsers diff --git a/Text/RE/Tools.hs b/Text/RE/Tools.hs index b304259..29c73ae 100644 --- a/Text/RE/Tools.hs +++ b/Text/RE/Tools.hs @@ -8,13 +8,21 @@ module Text.RE.Tools , sed' -- * Grep , grep + , Verbosity(..) + , Line(..) , grepLines + , grepFilter , GrepScript - , grepScript + , grepWithScript + , report , linesMatched -- * Lex , alex , alex' + -- * Find + , FindMethods(..) + , findMatches + , findMatches' -- * IsRegex , IsRegex(..) -- * Edit @@ -35,6 +43,7 @@ module Text.RE.Tools import Text.RE import Text.RE.Tools.Edit +import Text.RE.Tools.Find import Text.RE.Tools.Grep import Text.RE.Tools.Lex import Text.RE.Tools.Sed diff --git a/Text/RE/Tools/Find.lhs b/Text/RE/Tools/Find.lhs new file mode 100644 index 0000000..fcfcb57 --- /dev/null +++ b/Text/RE/Tools/Find.lhs @@ -0,0 +1,71 @@ +\begin{code} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE CPP #-} +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} +#endif + +module Text.RE.Tools.Find + ( FindMethods(..) + , findMatches + , findMatches' + -- * Text.RE + , module Text.RE + ) where + +import qualified Data.List as L +import Prelude.Compat +import Text.RE +import Text.RE.Replace + + +-- | as we don't want the @directory@ and FilePath dependencies +-- we will abstract the three calls we need into this record type +data FindMethods s = + FindMethods + { doesDirectoryExistDM :: s -> IO Bool -- ^ doesDirectoryExist from + -- System.Directory + , listDirectoryDM :: s -> IO [s] -- ^ either getDirectoryContents + -- or listDirectory from + -- System.Directory + , combineDM :: s -> s -> s -- ^ from System.FilePath + } + + +-- | recursively list all files whose filename matches given RE, +-- sorting the list into ascending order; +-- if the argument path has a trailing '/' then it will be removed +findMatches :: IsRegex re s => FindMethods s -> re -> s -> IO [s] +findMatches fm = findMatches' fm L.sort matched + +-- | recursively list all files whose filename matches given RE, +-- using the given function to determine which matches to accept; +findMatches' :: IsRegex re s + => FindMethods s -- ^ the directory and filepath methods + -> ([s]->[s]) -- ^ result post-processing function + -> (Match s->Bool) -- ^ filtering function + -> re -- ^ re to be matched against the leaf filename + -> s -- ^ root directory of the search + -> IO [s] +findMatches' fm srt tst re fp = srt <$> find_ fm tst re (packR "") fp + +find_ :: IsRegex re s + => FindMethods s + -> (Match s->Bool) + -> re + -> s + -> s + -> IO [s] +find_ fm@FindMethods{..} tst re fn fp = do + is_dir <- doesDirectoryExistDM fp + case is_dir of + True -> do + fns <- filter ordinary <$> listDirectoryDM fp + concat <$> + mapM (uncurry $ find_ fm tst re) [ (fn_,abs_path fn_) | fn_<-fns ] + False -> return [ fp | lengthR fp /= 0 && tst (matchOnce re fn) ] + where + abs_path fn_ = fp `combineDM` fn_ + ordinary fn_ = not $ fn_ `elem` [packR ".",packR ".."] +\end{code} diff --git a/Text/RE/Tools/Grep.lhs b/Text/RE/Tools/Grep.lhs index fb713a9..3811364 100644 --- a/Text/RE/Tools/Grep.lhs +++ b/Text/RE/Tools/Grep.lhs @@ -6,12 +6,13 @@ module Text.RE.Tools.Grep ( grep + , Verbosity(..) , Line(..) , grepLines + , grepFilter , GrepScript - , grepScript + , grepWithScript , report - , Verbosity(..) , linesMatched -- * IsRegex , IsRegex(..) @@ -28,6 +29,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS import Prelude.Compat import Text.Printf import Text.RE +import Text.RE.ZeInternals.Replace import Text.RE.ZeInternals.Types.LineNo @@ -35,20 +37,33 @@ import Text.RE.ZeInternals.Types.LineNo grep :: IsRegex re LBS.ByteString => Verbosity -> re -> FilePath -> IO () grep v rex fp = grepLines rex fp >>= putStr . report v +-- | specifies whether to return the linss matched or missed +data Verbosity + = LinesMatched + | LinesNotMatched + deriving (Show,Eq,Ord) + -- | 'grepLines' returns a 'Line' for each line in the file, listing all -- of the 'Matches' for that line -data Line = +data Line s = Line - { getLineNumber :: LineNo -- ^ the 'LineNo' for this line - , getLineMatches :: Matches LBS.ByteString -- ^ all the 'Matches' of the RE on this line + { getLineNumber :: LineNo -- ^ the 'LineNo' for this line + , getLineMatches :: Matches s -- ^ all the 'Matches' of the RE on this line } deriving (Show) --- | returns a 'Line' for each line in the file enumerating all of the --- matches for that line. -grepLines :: IsRegex re LBS.ByteString => re -> FilePath -> IO [Line] -grepLines rex fp = - grepScript [(rex,mk)] . LBS.lines <$> LBS.readFile fp +-- | returns a 'Line' for each line in the file, enumerating all of the +-- matches for that line +grepLines :: IsRegex re LBS.ByteString + => re + -> FilePath + -> IO [Line LBS.ByteString] +grepLines rex fp = grepFilter rex <$> LBS.readFile fp + +-- | returns a 'Line' for each line in the argument text, enumerating +-- all of the matches for that line +grepFilter :: IsRegex re s => re -> s -> [Line s] +grepFilter rex = grepWithScript [(rex,mk)] . linesR where mk i mtchs = Just $ Line i mtchs @@ -57,8 +72,8 @@ grepLines rex fp = type GrepScript re s t = [(re,LineNo -> Matches s -> Maybe t)] -- | given a list of lines, apply the 'GrepScript' to each line of the file -grepScript :: IsRegex re s => GrepScript re s t -> [s] -> [t] -grepScript scr = loop firstLine +grepWithScript :: IsRegex re s => GrepScript re s t -> [s] -> [t] +grepWithScript scr = loop firstLine where loop _ [] = [] loop i (ln:lns) = seq i $ choose i ln lns scr @@ -69,22 +84,16 @@ grepScript scr = loop firstLine Just t -> t : loop (succ i) lns -- | generate a grep report from a list of 'Line' -report :: Verbosity -> [Line] -> String +report :: Verbosity -> [Line LBS.ByteString] -> String report v = unlines . map fmt . linesMatched v where fmt Line{..} = printf "%05d %s" (getLineNo getLineNumber) $ LBS.unpack $ matchesSource getLineMatches --- | specifies whether to return the linss matched or missed -data Verbosity - = LinesMatched - | LinesNotMatched - deriving (Show,Eq,Ord) - -- | given a 'velocity' flag filter out either the lines matched or not -- matched -linesMatched :: Verbosity -> [Line] -> [Line] +linesMatched :: Verbosity -> [Line s] -> [Line s] linesMatched v = filter $ f . anyMatches . getLineMatches where f = case v of diff --git a/Text/RE/Tools/Lex.hs b/Text/RE/Tools/Lex.hs index 68ff33f..17706f7 100644 --- a/Text/RE/Tools/Lex.hs +++ b/Text/RE/Tools/Lex.hs @@ -8,4 +8,4 @@ module Text.RE.Tools.Lex ) where import Text.RE -import Text.RE.ZeInternals.Lex +import Text.RE.ZeInternals.Tools.Lex diff --git a/Text/RE/Tools/Sed.lhs b/Text/RE/Tools/Sed.lhs index e36dacb..38738b4 100644 --- a/Text/RE/Tools/Sed.lhs +++ b/Text/RE/Tools/Sed.lhs @@ -56,10 +56,10 @@ sed' :: (IsRegex re a,Monad m,Functor m) => Edits m re a -> a -> m a -sed' as lbs = do +sed' as t = do mconcat <$> sequence [ applyEdits lno as s - | (lno,s)<-zip [firstLine..] $ linesR lbs + | (lno,s)<-zip [firstLine..] $ linesR t ] read_file :: FilePath -> IO LBS.ByteString diff --git a/Text/RE/ZeInternals/AddCaptureNames.hs b/Text/RE/ZeInternals/AddCaptureNames.hs index e34a8bd..4674a89 100644 --- a/Text/RE/ZeInternals/AddCaptureNames.hs +++ b/Text/RE/ZeInternals/AddCaptureNames.hs @@ -6,8 +6,8 @@ module Text.RE.ZeInternals.AddCaptureNames where -import qualified Data.ByteString.Lazy.Char8 as LBS import qualified Data.ByteString.Char8 as B +import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Dynamic import Data.Maybe import qualified Data.Sequence as S diff --git a/Text/RE/ZeInternals/NamedCaptures.lhs b/Text/RE/ZeInternals/NamedCaptures.lhs index bf99251..662ad93 100644 --- a/Text/RE/ZeInternals/NamedCaptures.lhs +++ b/Text/RE/ZeInternals/NamedCaptures.lhs @@ -27,10 +27,10 @@ import qualified Data.Text as T import GHC.Generics import qualified Language.Haskell.TH as TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.Lex import Text.RE.ZeInternals.PreludeMacros import Text.RE.ZeInternals.QQ import Text.RE.ZeInternals.TestBench +import Text.RE.ZeInternals.Tools.Lex import Text.RE.ZeInternals.Types.CaptureID import Text.RE.ZeInternals.Types.Match import Text.Regex.TDFA diff --git a/Text/RE/ZeInternals/PreludeMacros.hs b/Text/RE/ZeInternals/PreludeMacros.hs index ccbd091..68f8121 100644 --- a/Text/RE/ZeInternals/PreludeMacros.hs +++ b/Text/RE/ZeInternals/PreludeMacros.hs @@ -30,9 +30,9 @@ import Data.Maybe import qualified Data.Text as T import Data.Time import Prelude.Compat -import Text.RE.TestBench -import Text.RE.ZeInternals.TestBench import Text.RE.REOptions +import Text.RE.ZeInternals.TestBench +import Text.RE.ZeInternals.TestBench.Parsers -- | generate the standard prelude Macros used to parse REs diff --git a/Text/RE/ZeInternals/Replace.lhs b/Text/RE/ZeInternals/Replace.lhs index 825ac9c..0b45fc7 100644 --- a/Text/RE/ZeInternals/Replace.lhs +++ b/Text/RE/ZeInternals/Replace.lhs @@ -48,11 +48,11 @@ import qualified Data.Text as T import qualified Data.Text.Encoding as TE import qualified Data.Text.Lazy as LT import Prelude.Compat +import Text.RE.REOptions import Text.RE.ZeInternals.Types.Capture import Text.RE.ZeInternals.Types.CaptureID import Text.RE.ZeInternals.Types.Match import Text.RE.ZeInternals.Types.Matches -import Text.RE.REOptions import Text.Read import Text.Regex.TDFA import Text.Regex.TDFA.Text() diff --git a/Text/RE/ZeInternals/SearchReplace/PCRE.hs b/Text/RE/ZeInternals/SearchReplace/PCRE.hs index 7a85168..5df614f 100644 --- a/Text/RE/ZeInternals/SearchReplace/PCRE.hs +++ b/Text/RE/ZeInternals/SearchReplace/PCRE.hs @@ -23,8 +23,8 @@ module Text.RE.ZeInternals.SearchReplace.PCRE import Language.Haskell.TH import Language.Haskell.TH.Quote import Prelude.Compat -import Text.RE.ZeInternals.SearchReplace.PCREEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.PCREEdPrime -- | the @[ed| ... /// ... |]@ quasi quoters diff --git a/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString.hs b/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString.hs index 4a0ee6c..b66d953 100644 --- a/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString.hs +++ b/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString import qualified Data.ByteString.Char8 as B import Language.Haskell.TH import Language.Haskell.TH.Quote +import Text.RE.REOptions import Text.RE.ZeInternals.PCRE import Text.RE.ZeInternals.SearchReplace.PCREEdPrime -import Text.RE.REOptions import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString/Lazy.hs b/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString/Lazy.hs index bc6d282..e42dacf 100644 --- a/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString/Lazy.hs +++ b/Text/RE/ZeInternals/SearchReplace/PCRE/ByteString/Lazy.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy import qualified Data.ByteString.Lazy.Char8 as LBS import Language.Haskell.TH import Language.Haskell.TH.Quote +import Text.RE.REOptions import Text.RE.ZeInternals.PCRE import Text.RE.ZeInternals.SearchReplace.PCREEdPrime -import Text.RE.REOptions import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/PCRE/Sequence.hs b/Text/RE/ZeInternals/SearchReplace/PCRE/Sequence.hs index d525c83..4efb954 100644 --- a/Text/RE/ZeInternals/SearchReplace/PCRE/Sequence.hs +++ b/Text/RE/ZeInternals/SearchReplace/PCRE/Sequence.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.PCRE.Sequence import qualified Data.Sequence as S import Language.Haskell.TH import Language.Haskell.TH.Quote +import Text.RE.REOptions import Text.RE.ZeInternals.PCRE import Text.RE.ZeInternals.SearchReplace.PCREEdPrime -import Text.RE.REOptions import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/PCRE/String.hs b/Text/RE/ZeInternals/SearchReplace/PCRE/String.hs index 815b5f8..e23fb7a 100644 --- a/Text/RE/ZeInternals/SearchReplace/PCRE/String.hs +++ b/Text/RE/ZeInternals/SearchReplace/PCRE/String.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.PCRE.String import Language.Haskell.TH import Language.Haskell.TH.Quote +import Text.RE.REOptions import Text.RE.ZeInternals.PCRE import Text.RE.ZeInternals.SearchReplace.PCREEdPrime -import Text.RE.REOptions import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/PCREEdPrime.hs b/Text/RE/ZeInternals/SearchReplace/PCREEdPrime.hs index 687e0fd..960207a 100644 --- a/Text/RE/ZeInternals/SearchReplace/PCREEdPrime.hs +++ b/Text/RE/ZeInternals/SearchReplace/PCREEdPrime.hs @@ -18,9 +18,9 @@ import Language.Haskell.TH.Quote import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace -import Text.RE.ZeInternals.SearchReplace -import Text.RE.ZeInternals.QQ import Text.RE.ZeInternals.PCRE +import Text.RE.ZeInternals.QQ +import Text.RE.ZeInternals.SearchReplace import Text.RE.ZeInternals.Types.IsRegex import Text.Regex.PCRE diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA.hs b/Text/RE/ZeInternals/SearchReplace/TDFA.hs index cc8af10..0ab32ea 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA.hs @@ -23,8 +23,8 @@ module Text.RE.ZeInternals.SearchReplace.TDFA import Language.Haskell.TH import Language.Haskell.TH.Quote import Prelude.Compat -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime -- | the @[ed| ... /// ... |]@ quasi quoters diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs b/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs index ab92993..023cf8c 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString import qualified Data.ByteString.Char8 as B import Language.Haskell.TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.TDFA -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime +import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString/Lazy.hs b/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString/Lazy.hs index 9158f94..1e8c80f 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString/Lazy.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA/ByteString/Lazy.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy import qualified Data.ByteString.Lazy.Char8 as LBS import Language.Haskell.TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.TDFA -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime +import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA/Sequence.hs b/Text/RE/ZeInternals/SearchReplace/TDFA/Sequence.hs index 30169b1..6cf903b 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA/Sequence.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA/Sequence.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.TDFA.Sequence import qualified Data.Sequence as S import Language.Haskell.TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.TDFA -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime +import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA/String.hs b/Text/RE/ZeInternals/SearchReplace/TDFA/String.hs index 9a5cd46..ade8b55 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA/String.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA/String.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.TDFA.String import Language.Haskell.TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.TDFA -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime +import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs b/Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs index cccea3e..3a0607e 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.TDFA.Text import qualified Data.Text as T import Language.Haskell.TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.TDFA -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime +import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/TDFA/Text/Lazy.hs b/Text/RE/ZeInternals/SearchReplace/TDFA/Text/Lazy.hs index bc3d4ff..378b679 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFA/Text/Lazy.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFA/Text/Lazy.hs @@ -24,9 +24,9 @@ module Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy import qualified Data.Text.Lazy as TL import Language.Haskell.TH import Language.Haskell.TH.Quote -import Text.RE.ZeInternals.TDFA -import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime import Text.RE.REOptions +import Text.RE.ZeInternals.SearchReplace.TDFAEdPrime +import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.SearchReplace diff --git a/Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs b/Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs index 318987e..abfa5c6 100644 --- a/Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs +++ b/Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs @@ -18,8 +18,8 @@ import Language.Haskell.TH.Quote import Prelude.Compat import Text.RE.REOptions import Text.RE.Replace -import Text.RE.ZeInternals.SearchReplace import Text.RE.ZeInternals.QQ +import Text.RE.ZeInternals.SearchReplace import Text.RE.ZeInternals.TDFA import Text.RE.ZeInternals.Types.IsRegex import Text.Regex.TDFA diff --git a/Text/RE/ZeInternals/TestBench.lhs b/Text/RE/ZeInternals/TestBench.lhs index ff12df4..2127802 100644 --- a/Text/RE/ZeInternals/TestBench.lhs +++ b/Text/RE/ZeInternals/TestBench.lhs @@ -41,8 +41,8 @@ import qualified Data.List as L import Data.Maybe import Data.Ord import Data.String -import Text.Printf import Prelude.Compat +import Text.Printf import Text.RE.REOptions import Text.RE.ZeInternals.Replace import Text.RE.ZeInternals.Types.Capture diff --git a/Text/RE/ZeInternals/TestBench/Parsers.hs b/Text/RE/ZeInternals/TestBench/Parsers.hs new file mode 100644 index 0000000..f4c403b --- /dev/null +++ b/Text/RE/ZeInternals/TestBench/Parsers.hs @@ -0,0 +1,189 @@ +{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} +{-# LANGUAGE OverloadedStrings #-} + +module Text.RE.ZeInternals.TestBench.Parsers + ( + -- * The Test Bench + MacroEnv + , MacroDescriptor(..) + , RegexSource(..) + , WithCaptures(..) + , RegexType + , isTDFA + , isPCRE + , presentRegexType + -- ** Constructing a MacrosEnv + , mkMacros + -- ** Formatting Macros + , formatMacroTable + , formatMacroSummary + , formatMacroSources + , formatMacroSource + -- ** Formatting Macros + , testMacroEnv + , runTests + , runTests' + -- * Parsing + , parseInteger + , parseHex + , parseDouble + , parseString + , parseSimpleString + , parseDate + , parseSlashesDate + , parseTimeOfDay + , parseTimeZone + , parseDateTime + , parseDateTime8601 + , parseDateTimeCLF + , parseShortMonth + , shortMonthArray + , IPV4Address + , parseIPv4Address + , Severity(..) + , parseSeverity + , severityKeywords + ) where + +import Data.Array +import qualified Data.HashMap.Strict as HM +import Data.Maybe +import qualified Data.Text as T +import Data.Time +import qualified Data.Time.Locale.Compat as LC +import Data.Word +import Text.Printf +import Text.RE.Replace +import Text.RE.ZeInternals.TestBench +import Text.Read + + +parseInteger :: Replace a => a -> Maybe Int +parseInteger = readMaybe . unpackR + +parseHex :: Replace a => a -> Maybe Int +parseHex = readMaybe . ("0x"++) . unpackR + +parseDouble :: Replace a => a -> Maybe Double +parseDouble = readMaybe . unpackR + +parseString :: Replace a => a -> Maybe T.Text +parseString = readMaybe . unpackR + +parseSimpleString :: Replace a => a -> Maybe T.Text +parseSimpleString = Just . T.dropEnd 1 . T.drop 1 . textifyR + +date_templates, time_templates, timezone_templates, + date_time_8601_templates, date_time_templates :: [String] +date_templates = ["%F"] +time_templates = ["%H:%M:%S","%H:%M:%S%Q","%H:%M"] +timezone_templates = ["Z","%z"] +date_time_8601_templates = + [ printf "%sT%s%s" dt tm tz + | dt <- date_templates + , tm <- time_templates + , tz <- timezone_templates + ] +date_time_templates = + [ printf "%s%c%s%s" dt sc tm tz + | dt <- date_templates + , sc <- ['T',' '] + , tm <- time_templates + , tz <- timezone_templates ++ [" UTC",""] + ] + +parseDate :: Replace a => a -> Maybe Day +parseDate = parse_time date_templates + +parseSlashesDate :: Replace a => a -> Maybe Day +parseSlashesDate = parse_time ["%Y/%m/%d"] + +parseTimeOfDay :: Replace a => a -> Maybe TimeOfDay +parseTimeOfDay = parse_time time_templates + +parseTimeZone :: Replace a => a -> Maybe TimeZone +parseTimeZone = parse_time timezone_templates + +parseDateTime :: Replace a => a -> Maybe UTCTime +parseDateTime = parse_time date_time_templates + +parseDateTime8601 :: Replace a => a -> Maybe UTCTime +parseDateTime8601 = parse_time date_time_8601_templates + +parseDateTimeCLF :: Replace a => a -> Maybe UTCTime +parseDateTimeCLF = parse_time ["%d/%b/%Y:%H:%M:%S %z"] + +parseShortMonth :: Replace a => a -> Maybe Int +parseShortMonth = flip HM.lookup short_month_hm . unpackR + +parse_time :: (ParseTime t,Replace s) => [String] -> s -> Maybe t +parse_time tpls = prs . unpackR + where + prs s = listToMaybe $ catMaybes + [ parseTime LC.defaultTimeLocale fmt s + | fmt<-tpls + ] + +short_month_hm :: HM.HashMap String Int +short_month_hm = HM.fromList [ (T.unpack $ shortMonthArray!i,i) | i<-[1..12] ] + +shortMonthArray :: Array Int T.Text +shortMonthArray = listArray (1,12) $ + T.words "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec" + +type IPV4Address = (Word8,Word8,Word8,Word8) + +parseIPv4Address :: Replace a => a -> Maybe IPV4Address +parseIPv4Address = prs . words_by (=='.') . unpackR + where + prs [a_s,b_s,c_s,d_s] = do + a <- readMaybe a_s + b <- readMaybe b_s + c <- readMaybe c_s + d <- readMaybe d_s + case all is_o [a,b,c,d] of + True -> Just (toEnum a,toEnum b,toEnum c,toEnum d) + False -> Nothing + prs _ = Nothing + + is_o x = 0 <= x && x <= 255 + +data Severity + = Emerg + | Alert + | Crit + | Err + | Warning + | Notice + | Info + | Debug + deriving (Bounded,Enum,Ord,Eq,Show) + +parseSeverity :: Replace a => a -> Maybe Severity +parseSeverity = flip HM.lookup severity_hm . textifyR + +severity_hm :: HM.HashMap T.Text Severity +severity_hm = HM.fromList + [ (kw,pri) + | pri<-[minBound..maxBound] + , let (kw0,kws) = severityKeywords pri + , kw <- kw0:kws + ] + +severityKeywords :: Severity -> (T.Text,[T.Text]) +severityKeywords pri = case pri of + Emerg -> (,) "emerg" ["panic"] + Alert -> (,) "alert" [] + Crit -> (,) "crit" [] + Err -> (,) "err" ["error"] + Warning -> (,) "warning" ["warn"] + Notice -> (,) "notice" [] + Info -> (,) "info" [] + Debug -> (,) "debug" [] + +words_by :: (Char->Bool) -> String -> [String] +words_by f s = case dropWhile f s of + "" -> [] + s' -> w : words_by f s'' + where + (w, s'') = break f s' diff --git a/Text/RE/ZeInternals/Lex.lhs b/Text/RE/ZeInternals/Tools/Lex.lhs similarity index 96% rename from Text/RE/ZeInternals/Lex.lhs rename to Text/RE/ZeInternals/Tools/Lex.lhs index d2b24d7..95359d4 100644 --- a/Text/RE/ZeInternals/Lex.lhs +++ b/Text/RE/ZeInternals/Tools/Lex.lhs @@ -1,7 +1,7 @@ \begin{code} {-# LANGUAGE NoImplicitPrelude #-} -module Text.RE.ZeInternals.Lex +module Text.RE.ZeInternals.Tools.Lex ( alex , alex' ) where diff --git a/Text/RE/ZeInternals/Types/CaptureID.hs b/Text/RE/ZeInternals/Types/CaptureID.hs index 2749eab..6f5a1cf 100644 --- a/Text/RE/ZeInternals/Types/CaptureID.hs +++ b/Text/RE/ZeInternals/Types/CaptureID.hs @@ -2,10 +2,9 @@ module Text.RE.ZeInternals.Types.CaptureID where -import Data.Ix -import Data.Hashable import qualified Data.HashMap.Strict as HMS -import Data.Maybe +import Data.Hashable +import Data.Ix import qualified Data.Text as T @@ -38,12 +37,16 @@ newtype CaptureOrdinal = CaptureOrdinal { getCaptureOrdinal :: Int } deriving (Show,Ord,Eq,Enum,Ix,Num) -- | look up a 'CaptureID' in the 'CaptureNames' dictionary -findCaptureID :: CaptureID -> CaptureNames -> Int -findCaptureID (IsCaptureOrdinal o) _ = getCaptureOrdinal o +unsafeFindCaptureID :: CaptureID -> CaptureNames -> Int +unsafeFindCaptureID cid = either error id . findCaptureID cid + +-- | look up a 'CaptureID' in the 'CaptureNames' dictionary +findCaptureID :: CaptureID -> CaptureNames -> Either String Int +findCaptureID (IsCaptureOrdinal o) _ = Right $ getCaptureOrdinal o findCaptureID (IsCaptureName n) hms = - getCaptureOrdinal $ fromMaybe oops $ HMS.lookup n hms + maybe oops (Right . getCaptureOrdinal) $ HMS.lookup n hms where - oops = error $ unlines $ + oops = Left $ unlines $ ("lookupCaptureID: " ++ T.unpack t ++ " not found in:") : [ " "++T.unpack (getCaptureName nm) | nm <- HMS.keys hms ] t = getCaptureName n diff --git a/Text/RE/ZeInternals/Types/Match.lhs b/Text/RE/ZeInternals/Types/Match.lhs index 876cf01..2e7e111 100644 --- a/Text/RE/ZeInternals/Types/Match.lhs +++ b/Text/RE/ZeInternals/Types/Match.lhs @@ -31,9 +31,9 @@ module Text.RE.ZeInternals.Types.Match import Data.Array import Data.Maybe import Data.Typeable -import Text.Regex.Base import Text.RE.ZeInternals.Types.Capture import Text.RE.ZeInternals.Types.CaptureID +import Text.Regex.Base infixl 9 !$, !$$ \end{code} @@ -142,17 +142,17 @@ capture cid mtch = fromMaybe oops $ mtch !$? cid -- capture failed to capture anything (being in a failed alternate) captureMaybe :: CaptureID -> Match a -> Maybe (Capture a) captureMaybe cid mtch@Match{..} = do + i <- lookupCaptureID cid mtch cap <- case bounds matchArray `inRange` CaptureOrdinal i of True -> Just $ matchArray ! CaptureOrdinal i False -> Nothing case hasCaptured cap of True -> Just cap False -> Nothing - where - i = lookupCaptureID cid mtch -lookupCaptureID :: CaptureID -> Match a -> Int -lookupCaptureID cid Match{..} = findCaptureID cid captureNames +lookupCaptureID :: CaptureID -> Match a -> Maybe Int +lookupCaptureID cid Match{..} = + either (const Nothing) Just $ findCaptureID cid captureNames \end{code} diff --git a/Text/RE/ZeInternals/Types/Matches.lhs b/Text/RE/ZeInternals/Types/Matches.lhs index 0e079f2..36b8d45 100644 --- a/Text/RE/ZeInternals/Types/Matches.lhs +++ b/Text/RE/ZeInternals/Types/Matches.lhs @@ -18,10 +18,10 @@ module Text.RE.ZeInternals.Types.Matches \begin{code} import Data.Typeable -import Text.Regex.Base import Text.RE.ZeInternals.Types.Capture import Text.RE.ZeInternals.Types.CaptureID import Text.RE.ZeInternals.Types.Match +import Text.Regex.Base \end{code} diff --git a/changelog b/changelog index f600eff..53745e4 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,14 @@ -*-change-log-*- +0.13.0.0 Chris Dornan 2017-04-03 + * Add a Find Tool (#106) + * TestBench to export Text.RE (#107) + * Consolidate cabal templates (#108) + * Add special tutorials (#109) + * Add sort-imports example (#110) + * Generalise Grep (#111) + * Tighten up findCaptureID (#112) + 0.12.0.0 Chris Dornan 2017-03-31 * Add Text.RE.REOptions to RE.Summa (#103) * Move IsRegex into Text.RE (#104) diff --git a/examples/TestKit.lhs b/examples/TestKit.lhs index e054801..6943458 100644 --- a/examples/TestKit.lhs +++ b/examples/TestKit.lhs @@ -24,14 +24,18 @@ module TestKit , include , cmp , dumpMacroTable + , sortImports + , read_file + , write_file ) where import Control.Applicative import Control.Exception import qualified Control.Monad as M +import qualified Data.ByteString.Lazy.Char8 as LBS +import qualified Data.List as L import Data.Maybe import qualified Data.Text as T -import qualified Data.ByteString.Lazy.Char8 as LBS import Prelude.Compat import qualified Shelly as SH import System.Directory @@ -39,12 +43,11 @@ import System.Environment import System.Exit import System.IO import Text.Printf +import Text.RE.Replace import Text.RE.TDFA import Text.RE.TestBench import Text.RE.Tools.Grep import Text.RE.Tools.Sed -import Text.RE.ZeInternals.Types.Match -import Text.RE.Replace \end{code} @@ -180,12 +183,28 @@ simple include processor \begin{code} include :: LBS.ByteString -> IO LBS.ByteString include = sed' $ Select - [ Function [re|^%include ${file}(@{%string})$|] TOP incl - , Function [re|^.*$|] TOP $ \_ _ _ _->return Nothing + [ Function [re|^%include ${file}(@{%string})$|] TOP incl + , Function [re|^%include ${file}(@{%string}) *exclude *${rex}(@{%string})$|] TOP incl + , Function [re|^.*$|] TOP nop ] where - incl _ mtch _ _ = Just <$> LBS.readFile (prs_s $ mtch !$$ [cp|file|]) - prs_s = maybe (error "include") T.unpack . parseString + incl _ mtch _ _ = include' mtch + nop _ _ _ _ = return Nothing + +include' :: Match LBS.ByteString -> IO (Maybe LBS.ByteString) +include' mtch = do + ftr <- case prs_s <$> mtch !$$? [cp|rex|] of + Nothing -> return id + Just re_lbs -> excl <$> makeRegex re_lbs + Just . ftr <$> LBS.readFile (prs_s $ mtch !$$ [cp|file|]) + where + excl :: RE -> LBS.ByteString -> LBS.ByteString + excl rex = + LBS.unlines . map (matchesSource . getLineMatches) + . filter (not . anyMatches . getLineMatches) + . grepFilter rex + + prs_s = maybe (error "include'") T.unpack . parseString \end{code} @@ -221,3 +240,42 @@ dumpMacroTable fp_t fp_s rty m_env = do writeFile fp_t $ formatMacroTable rty m_env writeFile fp_s $ formatMacroSources rty ExclCaptures m_env \end{code} + + +sortImports +----------- + +\begin{code} +sortImports :: LBS.ByteString -> LBS.ByteString +sortImports lbs = + LBS.unlines $ map (matchesSource . getLineMatches) $ + hdr ++ L.sortBy cMp bdy + where + cMp ln1 ln2 = case (extr ln1,extr ln2) of + (Nothing,Nothing) -> EQ + (Nothing,Just _ ) -> GT + (Just _ ,Nothing) -> LT + (Just x ,Just y) -> compare x y + + extr Line{..} = case allMatches getLineMatches of + mtch:_ -> mtch !$$? [cp|mod|] + _ -> Nothing + + (hdr,bdy) = span (not . anyMatches . getLineMatches) lns + lns = grepFilter rex lbs + rex = [re|^import +(qualified)? +${mod}([^ ].*)$|] +\end{code} + + +read_file and write_file +------------------------ + +\begin{code} +read_file :: FilePath -> IO LBS.ByteString +read_file "-" = LBS.getContents +read_file fp = LBS.readFile fp + +write_file :: FilePath -> LBS.ByteString ->IO () +write_file "-" = LBS.putStr +write_file fp = LBS.writeFile fp +\end{code} diff --git a/examples/re-gen-modules.lhs b/examples/re-gen-modules.lhs index 35949c1..d014ba0 100644 --- a/examples/re-gen-modules.lhs +++ b/examples/re-gen-modules.lhs @@ -16,15 +16,14 @@ The tool is self-testing: run it with no arguments (or `cabal test`). module Main (main) where -import Control.Exception import qualified Data.ByteString.Lazy.Char8 as LBS import qualified Data.Text as T import Prelude.Compat -import qualified Shelly as SH import System.Directory import System.Environment import System.Exit import System.IO +import TestKit import Text.RE.TDFA.ByteString.Lazy import Text.RE.Tools.Sed @@ -62,9 +61,11 @@ type SedScript = Edits IO RE LBS.ByteString test' :: ModPath -> (ModPath,SedScript) -> IO Bool test' src_mp (mp,scr) = do putStrLn mp - tp <- is_text_present - sed scr (mod_filepath tp src_mp) tmp_pth - cmp (T.pack tmp_pth) (T.pack $ mod_filepath tp mp) + tp <- is_text_present + lbs <- read_file $ mod_filepath tp src_mp + lbs' <- sortImports <$> sed' scr lbs + write_file tmp_pth lbs' + cmp (T.pack tmp_pth) (T.pack $ mod_filepath tp mp) where tmp_pth = "tmp/prog.hs" @@ -83,8 +84,10 @@ gen = do gen' :: FilePath -> (ModPath,SedScript) -> IO () gen' src_mp (mp,scr) = do putStrLn mp - tp <- is_text_present - sed scr (mod_filepath tp src_mp) (mod_filepath tp mp) + tp <- is_text_present + lbs <- read_file $ mod_filepath tp src_mp + lbs' <- sortImports <$> sed' scr lbs + write_file (mod_filepath tp mp) lbs' ------------------------------------------------------------------------ @@ -228,16 +231,4 @@ mod_filepath text_present mp = pfx ++ map tr mp ++ ".hs" is_text_present :: IO Bool is_text_present = doesDirectoryExist "Text" - -cmp :: T.Text -> T.Text -> IO Bool -cmp src dst = handle hdl $ do - _ <- SH.shelly $ SH.verbosely $ - SH.run "cmp" [src,dst] - return True - where - hdl :: SomeException -> IO Bool - hdl se = do - hPutStrLn stderr $ - "testing results against model answers failed: " ++ show se - return False \end{code} diff --git a/examples/re-include.lhs b/examples/re-include.lhs index 7a816cd..ea84ed2 100644 --- a/examples/re-include.lhs +++ b/examples/re-include.lhs @@ -32,12 +32,12 @@ import Prelude.Compat import System.Environment import TestKit import Text.RE -import Text.RE.Tools.Edit +import Text.RE.Replace import Text.RE.TDFA.ByteString.Lazy import Text.RE.TestBench +import Text.RE.Tools.Edit import Text.RE.Tools.Grep import Text.RE.Tools.Sed -import Text.RE.Replace \end{code} \begin{code} @@ -135,7 +135,7 @@ data Token = Bra LineNo | Hit | Ket LineNo deriving (Show) \begin{code} scan :: RE -> [LBS.ByteString] -> [Token] -scan rex = grepScript +scan rex = grepWithScript [ (,) [re|\\begin\{code\}|] $ \i -> chk $ Bra i , (,) rex $ \_ -> chk Hit , (,) [re|\\end\{code\}|] $ \i -> chk $ Ket i diff --git a/examples/re-nginx-log-processor.lhs b/examples/re-nginx-log-processor.lhs index 83b5d73..a5980f9 100644 --- a/examples/re-nginx-log-processor.lhs +++ b/examples/re-nginx-log-processor.lhs @@ -29,27 +29,27 @@ import Control.Applicative import Control.Monad import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Char -import qualified Data.HashMap.Lazy as HML import Data.Functor.Identity +import qualified Data.HashMap.Lazy as HML import Data.Maybe import Data.String import qualified Data.Text as T import Data.Time import Prelude.Compat import System.Directory -import System.FilePath import System.Environment import System.Exit +import System.FilePath import System.IO import TestKit +import Text.Printf import Text.RE import Text.RE.PCRE.ByteString.Lazy import qualified Text.RE.PCRE.String as S -import Text.RE.TestBench -import Text.RE.Tools.Sed import Text.RE.REOptions import Text.RE.Replace -import Text.Printf +import Text.RE.TestBench +import Text.RE.Tools.Sed \end{code} \begin{code} diff --git a/examples/re-prep.lhs b/examples/re-prep.lhs index f43e633..6d33090 100644 --- a/examples/re-prep.lhs +++ b/examples/re-prep.lhs @@ -28,22 +28,22 @@ import Data.IORef import Data.Maybe import Data.Monoid import qualified Data.Text as T -import qualified Data.Text.Encoding as TE import Network.HTTP.Conduit import Prelude.Compat import qualified Shelly as SH import System.Directory import System.Environment +import System.FilePath import System.IO import TestKit import Text.Heredoc import Text.RE +import Text.RE.Replace +import Text.RE.TDFA.ByteString.Lazy +import qualified Text.RE.TDFA.String as TS import Text.RE.TestBench import Text.RE.Tools.Grep import Text.RE.Tools.Sed -import Text.RE.TDFA.ByteString.Lazy -import qualified Text.RE.TDFA.Text as TT -import Text.RE.Replace \end{code} \begin{code} @@ -178,34 +178,48 @@ gen_all = do pd "RE/Tools/Edit" pd "RE/Tools/Grep" pd "RE/Tools/Sed" - pd "RE/ZeInternals/Lex" pd "RE/ZeInternals/NamedCaptures" pd "RE/ZeInternals/Replace" pd "RE/ZeInternals/TestBench" + pd "RE/ZeInternals/Tools/Lex" pd "RE/ZeInternals/Types/IsRegex" pd "RE/ZeInternals/Types/Matches" pd "RE/ZeInternals/Types/Match" pd "RE/ZeInternals/Types/Capture" -- render the tutorial in HTML - prep_tut Doc "examples/re-tutorial-master.lhs" "tmp/re-tutorial.lhs" createDirectoryIfMissing False "tmp" - pandoc_lhs' - "re-tutorial.lhs" - "examples/re-tutorial.lhs" - "tmp/re-tutorial.lhs" - "docs/re-tutorial.html" - -- generate the tutorial-based tests - gm <- genMode - prep_tut gm "examples/re-tutorial-master.lhs" "examples/re-tutorial.lhs" - putStrLn ">> examples/re-tutorial.lhs" + gen_tutorial "tutorial" + gen_tutorial "tutorial-options" + gen_tutorial "tutorial-replacing" + gen_tutorial "tutorial-testbench" + gen_tutorial "tutorial-tools" pages where pd fnm = case (mtch !$$? [cp|fdr|],mtch !$$? [cp|mnm|]) of - (Nothing ,Just mnm) -> pandoc_lhs ("Text.RE." <>mnm) ("Text/" <>fnm<>".lhs") ("docs/"<>mnm<>".html") - (Just fdr,Just mnm) -> pandoc_lhs ("Text.RE."<>fdr<>"."<>mnm) ("Text/" <>fnm<>".lhs") ("docs/"<>mnm<>".html") - _ -> pandoc_lhs ("examples/"<>fnm<>".lhs" ) ("examples/"<>fnm<>".lhs") ("docs/"<>fnm<>".html") + (Nothing ,Just mnm) -> pandoc_lhs ("Text.RE." ++mnm) ("Text/" ++fnm++".lhs") ("docs/"++mnm++".html") + (Just fdr,Just mnm) -> pandoc_lhs ("Text.RE."++fdr++"."++mnm) ("Text/" ++fnm++".lhs") ("docs/"++mnm++".html") + _ -> pandoc_lhs ("examples/"++fnm++".lhs" ) ("examples/"++fnm++".lhs") ("docs/"++fnm++".html") where - mtch = fnm TT.?=~ [re|^RE/(${fdr}(Internal|PCRE|TDFA|Testbench|Tools|Types)/)?${mnm}(@{%id})|] + mtch = fnm TS.?=~ [re|^RE/(${fdr}(Internal|PCRE|TDFA|Testbench|Tools|Types)/)?${mnm}(@{%id})|] +\end{code} + + +\begin{code} +gen_tutorial :: String -> IO () +gen_tutorial nm = do + prep_tut Doc ("examples" mst) ("tmp" tgt) + pandoc_lhs' tgt + ("examples" tgt) + ("tmp" tgt) + ("docs" htm) + -- generate the tutorial-based tests + gm <- genMode + prep_tut gm ("examples" mst) ("examples" tgt) + putStrLn $ ">> " ++ ("examples" tgt) + where + tgt = "re-" ++ nm ++ ".lhs" + htm = "re-" ++ nm ++ ".html" + mst = "re-" ++ nm ++ "-master.lhs" \end{code} @@ -359,7 +373,7 @@ data Token = Bra LineNo | Hit | Ket LineNo deriving (Show) \begin{code} scan :: RE -> [LBS.ByteString] -> [Token] -scan rex = grepScript +scan rex = grepWithScript [ (,) [re|\\begin\{code\}|] $ \i -> chk $ Bra i , (,) rex $ \_ -> chk Hit , (,) [re|\\end\{code\}|] $ \i -> chk $ Ket i @@ -703,15 +717,15 @@ Literate Haskell Pages ---------------------- \begin{code} -pandoc_lhs :: T.Text -> T.Text -> T.Text -> IO () +pandoc_lhs :: String -> String -> String -> IO () pandoc_lhs title in_file = pandoc_lhs' title in_file in_file -pandoc_lhs' :: T.Text -> T.Text -> T.Text -> T.Text -> IO () +pandoc_lhs' :: String -> String -> String -> String -> IO () pandoc_lhs' title repo_path in_file out_file = do LBS.writeFile "tmp/metadata.markdown" $ LBS.unlines [ "---" - , "title: "<>LBS.fromStrict (TE.encodeUtf8 title) + , "title: "<>LBS.pack title , "---" ] LBS.writeFile "tmp/bc.html" bc @@ -728,9 +742,9 @@ pandoc_lhs' title repo_path in_file out_file = do , "-A", "tmp/ft.html" , "-c", "lib/lhs-styles.css" , "-c", "lib/bs.css" - , "-o", out_file + , "-o", T.pack out_file , "tmp/metadata.markdown" - , in_file + , T.pack in_file ] where bc = LBS.unlines @@ -741,7 +755,7 @@ pandoc_lhs' title repo_path in_file out_file = do , " " , "" , "
" @@ -753,7 +767,7 @@ pandoc_lhs' title repo_path in_file out_file = do repo_url = LBS.concat [ "https://github.com/iconnect/regex/blob/master/" - , LBS.pack $ T.unpack repo_path + , LBS.pack repo_path ] \end{code} diff --git a/examples/re-sort-imports.lhs b/examples/re-sort-imports.lhs new file mode 100644 index 0000000..bf6e305 --- /dev/null +++ b/examples/re-sort-imports.lhs @@ -0,0 +1,130 @@ +Example: Sort-Import Processor +============================== + +This example looks for Haskell files and sorts their import statements +into a standard (alphabetical) order + +\begin{code} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE OverloadedStrings #-} + +module Main + ( main + ) where + +import Control.Applicative +import qualified Control.Monad as M +import qualified Data.ByteString.Lazy.Char8 as LBS +import Prelude.Compat +import System.Directory +import System.Environment +import System.Exit +import System.FilePath +import TestKit +import Text.Printf +import Text.RE.TDFA.String +import Text.RE.Tools.Find +\end{code} + +Mode +---- + +This program can run in one of two modes. + +\begin{code} +data Mode + = Check -- only check for unsorted files, generating an + -- error if any not sorted + | Update -- update any unsorted files + deriving (Eq,Show) +\end{code} + +\begin{code} +main :: IO () +main = do + as <- getArgs + case as of + [] -> test + ["test"] -> test + ["update",fp] | is_file fp -> sort_r Update fp + ["check" ,fp] | is_file fp -> sort_r Check fp + _ -> usage + where + is_file = not . (== "--") . take 2 + + test = do + sort_r Check "Text" + sort_r Check "examples" + + usage = do + prg <- getProgName + putStr $ unlines + [ "usage:" + , " "++prg++" [test]" + , " "++prg++" " + ] +\end{code} + + +The Find Script +--------------- + +\begin{code} +sort_r :: Mode -> FilePath -> IO () +sort_r md root = findMatches fm [re|\.l?hs|] root >>= sort_these md root + where + fm = FindMethods + { doesDirectoryExistDM = doesDirectoryExist + , listDirectoryDM = getDirectoryContents + , combineDM = () + } +\end{code} + + +Processing the List of Files +---------------------------- + +\begin{code} +sort_these :: Mode -> FilePath -> [FilePath] -> IO () +sort_these md root fps = do + ok <- and <$> mapM (sort_this md) fps + case ok of + True -> msg "all imports sorted" + False -> case md of + Check -> do + msg "Some imports need sorting" + exitWith $ ExitFailure 1 + Update -> + msg "Some imports were sorted" + where + msg :: String -> IO () + msg s = printf "%-10s : %s\n" root s +\end{code} + + +Processing a single File +------------------------ + +\begin{code} +sort_this :: Mode -> FilePath -> IO Bool +sort_this md fp = LBS.readFile fp >>= sort_this' + where + sort_this' lbs = do + M.when (not same) $ putStrLn fp + M.when (md==Update) $ LBS.writeFile fp lbs' + return same + where + same = lbs==lbs' + lbs' = sortImports lbs +\end{code} + + +Sorting the Imports of the Text of a Haskell Script +--------------------------------------------------- + +The function for sorting a Haskell script, `sortImports` has been +placed in `TestKit` so that it can be shared with re-gen-modules`. diff --git a/examples/re-tests.lhs b/examples/re-tests.lhs index 348981b..bfe3679 100644 --- a/examples/re-tests.lhs +++ b/examples/re-tests.lhs @@ -43,35 +43,37 @@ import Prelude.Compat import System.Directory import System.FilePath import Test.SmallCheck.Series -import TestKit import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.SmallCheck as SC +import TestKit import Text.Heredoc -import qualified Text.Regex.PCRE as PCRE_ -import qualified Text.Regex.TDFA as TDFA_ import Text.RE -import Text.RE.Replace import qualified Text.RE.PCRE as PCRE -import Text.RE.TDFA as TDFA -import Text.RE.TestBench -import Text.RE.Tools.Sed -import Text.RE.ZeInternals.AddCaptureNames -import Text.RE.ZeInternals.NamedCaptures -import Text.RE.ZeInternals.PreludeMacros -import Text.RE.REOptions - -import qualified Text.RE.PCRE.String as P_ST import qualified Text.RE.PCRE.ByteString as P_BS import qualified Text.RE.PCRE.ByteString.Lazy as PLBS import qualified Text.RE.PCRE.Sequence as P_SQ - -import qualified Text.RE.TDFA.String as T_ST +import qualified Text.RE.PCRE.String as P_ST +import Text.RE.REOptions +import Text.RE.Replace +import Text.RE.TDFA as TDFA import qualified Text.RE.TDFA.ByteString as T_BS import qualified Text.RE.TDFA.ByteString.Lazy as TLBS import qualified Text.RE.TDFA.Sequence as T_SQ +import qualified Text.RE.TDFA.String as T_ST import qualified Text.RE.TDFA.Text as T_TX import qualified Text.RE.TDFA.Text.Lazy as TLTX +import Text.RE.TestBench +import Text.RE.Tools.Find +import Text.RE.Tools.Sed +import Text.RE.ZeInternals.AddCaptureNames +import Text.RE.ZeInternals.NamedCaptures +import Text.RE.ZeInternals.PreludeMacros +import Text.RE.ZeInternals.Types.CaptureID +import qualified Text.Regex.PCRE as PCRE_ +import qualified Text.Regex.TDFA as TDFA_ + + \end{code} @@ -89,6 +91,7 @@ main = defaultMain $ , many_tests , escape_tests , add_capture_names_tests + , find_tests , misc_tests ] \end{code} @@ -586,14 +589,14 @@ Named Capture Tests named_capture_tests :: TestTree named_capture_tests = localOption (SmallCheckDepth 4) $ testGroup "NamedCaptures" - [ formatScanTestTree - , analyseTokensTestTree + [ format_scan_tests + , analyse_tokens_tests ] instance Monad m => Serial m Token -formatScanTestTree :: TestTree -formatScanTestTree = +format_scan_tests :: TestTree +format_scan_tests = testGroup "FormatToken/Scan Properties" [ localOption (SmallCheckDepth 4) $ SC.testProperty "formatTokens == formatTokens0" $ @@ -604,8 +607,8 @@ formatScanTestTree = scan (formatTokens' idFormatTokenREOptions tks) == tks ] -analyseTokensTestTree :: TestTree -analyseTokensTestTree = +analyse_tokens_tests :: TestTree +analyse_tokens_tests = testGroup "Analysing [Token] Unit Tests" [ tc [here|foobar|] [] , tc [here||] [] @@ -633,7 +636,7 @@ analyseTokensTestTree = xnc = either oops (snd . fst) . extractNamedCaptures where - oops = error "analyseTokensTestTree: unexpected parse failure" + oops = error "analyse_tokens_tests: unexpected parse failure" \end{code} @@ -678,6 +681,44 @@ test_add_capture_name lab tst x = testCase lab $ \end{code} +The Find Tests +-------------- + +\begin{code} +find_tests :: TestTree +find_tests = testGroup "Find Tests" + [ testCase "examples/" $ do + fps <- findMatches findMethods [re|^re-.*\.lhs|] "examples/" + example_paths @=? filter (not . matched . (?=~ [re|master\.lhs|])) fps + ] + +example_paths :: [String] +example_paths = + [ "examples/re-gen-cabals.lhs" + , "examples/re-gen-modules.lhs" + , "examples/re-include.lhs" + , "examples/re-nginx-log-processor.lhs" + , "examples/re-prep.lhs" + , "examples/re-sort-imports.lhs" + , "examples/re-tests.lhs" + , "examples/re-tutorial-options.lhs" + , "examples/re-tutorial-replacing.lhs" + , "examples/re-tutorial-testbench.lhs" + , "examples/re-tutorial-tools.lhs" + , "examples/re-tutorial.lhs" + ] + +findMethods :: FindMethods String +findMethods = + FindMethods + { doesDirectoryExistDM = doesDirectoryExist + , listDirectoryDM = getDirectoryContents + , combineDM = () + } + +\end{code} + + The Miscelaneous Tests ---------------------- @@ -686,7 +727,7 @@ misc_tests :: TestTree misc_tests = testGroup "Miscelaneous Tests" [ testGroup "CaptureID" [ testCase "CaptureID lookup failure" $ do - ok <- isValidError $ findCaptureID [cp|foo|] $ reCaptureNames [re|foo|] + ok <- isValidError $ unsafeFindCaptureID [cp|foo|] $ reCaptureNames [re|foo|] assertBool "failed" ok ] , testGroup "QQ" diff --git a/examples/re-tutorial-master.lhs b/examples/re-tutorial-master.lhs index 4460b31..9573772 100644 --- a/examples/re-tutorial-master.lhs +++ b/examples/re-tutorial-master.lhs @@ -83,6 +83,12 @@ For this tutorial we will use classic Haskell strings but any application dealing with bulk text will probably want to choose one of the other options. \begin{code} +import Control.Applicative +import Data.Maybe +import qualified Data.Text as T +import Prelude.Compat +import TestKit +import Text.Printf import Text.RE.REOptions import Text.RE.Replace import Text.RE.TDFA.String @@ -95,18 +101,12 @@ matter of convenience. We will also need access to a small selection of common libraries for our examples. \begin{code} -import Control.Applicative -import Data.Maybe -import qualified Data.Text as T -import Text.Printf \end{code} And finally we a special edition of the prelude (see the commentary for the pragma section above) and a small specail toolkit will be used to help manage the example calculations. \begin{code} -import Prelude.Compat -import TestKit \end{code} This allows simple calculations to be defined stylistically in the source program, presented as calculations when rendered diff --git a/examples/re-tutorial-options-master.lhs b/examples/re-tutorial-options-master.lhs new file mode 100644 index 0000000..3e91a30 --- /dev/null +++ b/examples/re-tutorial-options-master.lhs @@ -0,0 +1,23 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +%main bottom diff --git a/examples/re-tutorial-options.lhs b/examples/re-tutorial-options.lhs new file mode 100644 index 0000000..d90d588 --- /dev/null +++ b/examples/re-tutorial-options.lhs @@ -0,0 +1,29 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +\begin{code} +main :: IO () +main = runTheTests + [ evalme_TRD_00 + ] +\end{code} + diff --git a/examples/re-tutorial-replacing-master.lhs b/examples/re-tutorial-replacing-master.lhs new file mode 100644 index 0000000..3e91a30 --- /dev/null +++ b/examples/re-tutorial-replacing-master.lhs @@ -0,0 +1,23 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +%main bottom diff --git a/examples/re-tutorial-replacing.lhs b/examples/re-tutorial-replacing.lhs new file mode 100644 index 0000000..d90d588 --- /dev/null +++ b/examples/re-tutorial-replacing.lhs @@ -0,0 +1,29 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +\begin{code} +main :: IO () +main = runTheTests + [ evalme_TRD_00 + ] +\end{code} + diff --git a/examples/re-tutorial-testbench-master.lhs b/examples/re-tutorial-testbench-master.lhs new file mode 100644 index 0000000..3e91a30 --- /dev/null +++ b/examples/re-tutorial-testbench-master.lhs @@ -0,0 +1,23 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +%main bottom diff --git a/examples/re-tutorial-testbench.lhs b/examples/re-tutorial-testbench.lhs new file mode 100644 index 0000000..d90d588 --- /dev/null +++ b/examples/re-tutorial-testbench.lhs @@ -0,0 +1,29 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +\begin{code} +main :: IO () +main = runTheTests + [ evalme_TRD_00 + ] +\end{code} + diff --git a/examples/re-tutorial-tools-master.lhs b/examples/re-tutorial-tools-master.lhs new file mode 100644 index 0000000..3e91a30 --- /dev/null +++ b/examples/re-tutorial-tools-master.lhs @@ -0,0 +1,23 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +%main bottom diff --git a/examples/re-tutorial-tools.lhs b/examples/re-tutorial-tools.lhs new file mode 100644 index 0000000..d90d588 --- /dev/null +++ b/examples/re-tutorial-tools.lhs @@ -0,0 +1,29 @@ +The Regex Options Tutorial +========================== + +\begin{code} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -fno-warn-missing-signatures #-} +\end{code} + + +\begin{code} +import Prelude.Compat +import TestKit +import Text.RE.TDFA.String +\end{code} + + +\begin{code} +evalme_TRD_00 = checkThis "evalme_TRD_00" (True) $ ("2016-01-09 2015-12-5 2015-10-05" =~ [re|[0-9]{4}-[0-9]{2}-[0-9]{2}|] :: Bool) +\end{code} + + +\begin{code} +main :: IO () +main = runTheTests + [ evalme_TRD_00 + ] +\end{code} + diff --git a/examples/re-tutorial.lhs b/examples/re-tutorial.lhs index d62dc22..7347a57 100644 --- a/examples/re-tutorial.lhs +++ b/examples/re-tutorial.lhs @@ -92,6 +92,12 @@ For this tutorial we will use classic Haskell strings but any application dealing with bulk text will probably want to choose one of the other options. \begin{code} +import Control.Applicative +import Data.Maybe +import qualified Data.Text as T +import Prelude.Compat +import TestKit +import Text.Printf import Text.RE.REOptions import Text.RE.Replace import Text.RE.TDFA.String @@ -104,18 +110,12 @@ matter of convenience. We will also need access to a small selection of common libraries for our examples. \begin{code} -import Control.Applicative -import Data.Maybe -import qualified Data.Text as T -import Text.Printf \end{code} And finally we a special edition of the prelude (see the commentary for the pragma section above) and a small specail toolkit will be used to help manage the example calculations. \begin{code} -import Prelude.Compat -import TestKit \end{code} This allows simple calculations to be defined stylistically in the source program, presented as calculations when rendered diff --git a/lib/README-regex-examples.md b/lib/README-regex-examples.md index 0fd562d..53a3511 100644 --- a/lib/README-regex-examples.md +++ b/lib/README-regex-examples.md @@ -74,6 +74,8 @@ two packages:     ☒  2017-03-31 v0.12.0.0 [Move IsRegex into Text.RE](https://github.com/iconnect/regex/milestone/16) +    ☒  2017-04-02 v0.13.0.0 [Protect findCaptureID and add Find, re-sort-imports, tutorials](https://github.com/iconnect/regex/milestone/17) +     ☐  2017-04-03 v1.0.0.0 [First stable release](https://github.com/iconnect/regex/milestone/3)     ☐  2017-08-31 v2.0.0.0 [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4) diff --git a/lib/README-regex.md b/lib/README-regex.md index 6558b1b..b701c93 100644 --- a/lib/README-regex.md +++ b/lib/README-regex.md @@ -74,6 +74,8 @@ two packages:     ☒  2017-03-31 v0.12.0.0 [Move IsRegex into Text.RE](https://github.com/iconnect/regex/milestone/16) +    ☒  2017-04-02 v0.13.0.0 [Protect findCaptureID and add Find, re-sort-imports, tutorials](https://github.com/iconnect/regex/milestone/17) +     ☐  2017-04-03 v1.0.0.0 [First stable release](https://github.com/iconnect/regex/milestone/3)     ☐  2017-08-31 v2.0.0.0 [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4) diff --git a/lib/cabal-masters/executables-incl.cabal b/lib/cabal-masters/executables-incl.cabal index 4289192..f29d937 100644 --- a/lib/cabal-masters/executables-incl.cabal +++ b/lib/cabal-masters/executables-incl.cabal @@ -13,6 +13,9 @@ Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + %build-depends-prog regex array base base-compat bytestring directory regex-base regex-tdfa shelly text %test-exe re-include @@ -30,6 +33,9 @@ Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + %build-depends-prog regex regex-with-pcre array base base-compat bytestring directory filepath regex-base regex-tdfa shelly text time time-locale-compat transformers unordered-containers %test-exe re-prep @@ -40,7 +46,17 @@ Other-Modules: TestKit -%build-depends-prog regex base base-compat bytestring directory heredoc http-conduit shelly text +%build-depends-prog regex base base-compat bytestring directory filepath heredoc http-conduit shelly text + +%test-exe re-sort-imports + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + +%build-depends-prog regex base base-compat bytestring directory filepath shelly text %test-exe re-tests Hs-Source-Dirs: examples @@ -74,3 +90,47 @@ Extensions: OverloadedStrings Default-Extensions: QuasiQuotes %build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers + +%test-exe re-tutorial-options + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes +%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers + +%test-exe re-tutorial-replacing + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes +%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers + +%test-exe re-tutorial-testbench + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes +%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers + +%test-exe re-tutorial-tools + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes +%build-depends-prog regex array base base-compat bytestring containers directory hashable heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin shelly smallcheck tasty tasty-hunit tasty-smallcheck template-haskell transformers text time time-locale-compat unordered-containers diff --git a/lib/cabal-masters/library-incl.cabal b/lib/cabal-masters/library-incl.cabal index 1dff21a..d0d5821 100644 --- a/lib/cabal-masters/library-incl.cabal +++ b/lib/cabal-masters/library-incl.cabal @@ -20,13 +20,13 @@ Library Text.RE.TestBench Text.RE.Tools Text.RE.Tools.Edit + Text.RE.Tools.Find Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString - Text.RE.ZeInternals.Lex Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PCRE Text.RE.ZeInternals.PreludeMacros @@ -49,6 +49,8 @@ Library Text.RE.ZeInternals.SearchReplace.TDFAEdPrime Text.RE.ZeInternals.TDFA Text.RE.ZeInternals.TestBench + Text.RE.ZeInternals.TestBench.Parsers + Text.RE.ZeInternals.Tools.Lex Text.RE.ZeInternals.Types.Capture Text.RE.ZeInternals.Types.CaptureID Text.RE.ZeInternals.Types.IsRegex @@ -57,5 +59,4 @@ Library Text.RE.ZeInternals.Types.Matches Text.RE.ZeInternals.Types.SearchReplace - %build-depends-lib array bytestring base base-compat containers hashable regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin template-haskell text time time-locale-compat transformers unordered-containers diff --git a/lib/cabal-masters/regex.cabal b/lib/cabal-masters/regex.cabal index a5ca612..43039f1 100644 --- a/lib/cabal-masters/regex.cabal +++ b/lib/cabal-masters/regex.cabal @@ -1,55 +1,5 @@ Name: regex %include "lib/cabal-masters/regex-incl.cabal" %include "lib/cabal-masters/constraints-incl.cabal" - -Library - Hs-Source-Dirs: . - - Exposed-Modules: - Text.RE - Text.RE.REOptions - Text.RE.Replace - Text.RE.Summa - Text.RE.TDFA - Text.RE.TDFA.ByteString - Text.RE.TDFA.ByteString.Lazy - Text.RE.TDFA.Sequence - Text.RE.TDFA.String - Text.RE.TDFA.Text - Text.RE.TDFA.Text.Lazy - Text.RE.TestBench - Text.RE.Tools - Text.RE.Tools.Edit - Text.RE.Tools.Grep - Text.RE.Tools.Lex - Text.RE.Tools.Sed - Text.RE.ZeInternals - Text.RE.ZeInternals.AddCaptureNames - Text.RE.ZeInternals.EscapeREString - Text.RE.ZeInternals.Lex - Text.RE.ZeInternals.NamedCaptures - Text.RE.ZeInternals.PreludeMacros - Text.RE.ZeInternals.QQ - Text.RE.ZeInternals.Replace - Text.RE.ZeInternals.SearchReplace - Text.RE.ZeInternals.SearchReplace.TDFA - Text.RE.ZeInternals.SearchReplace.TDFA.ByteString - Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy - Text.RE.ZeInternals.SearchReplace.TDFA.Sequence - Text.RE.ZeInternals.SearchReplace.TDFA.String - Text.RE.ZeInternals.SearchReplace.TDFA.Text - Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy - Text.RE.ZeInternals.SearchReplace.TDFAEdPrime - Text.RE.ZeInternals.TDFA - Text.RE.ZeInternals.TestBench - Text.RE.ZeInternals.Types.Capture - Text.RE.ZeInternals.Types.CaptureID - Text.RE.ZeInternals.Types.IsRegex - Text.RE.ZeInternals.Types.LineNo - Text.RE.ZeInternals.Types.Match - Text.RE.ZeInternals.Types.Matches - Text.RE.ZeInternals.Types.SearchReplace - -%build-depends-lib array bytestring base base-compat containers hashable regex-base regex-tdfa regex-tdfa-text template-haskell text time time-locale-compat transformers unordered-containers - +%include "lib/cabal-masters/library-incl.cabal" exclude "PCRE" -- Generated with re-gen-cabals diff --git a/lib/md/roadmap-incl.md b/lib/md/roadmap-incl.md index e05fc47..06401fe 100644 --- a/lib/md/roadmap-incl.md +++ b/lib/md/roadmap-incl.md @@ -18,5 +18,6 @@ - [X] 2017-03-29 v0.11.0.0 [Simplify the API](https://github.com/iconnect/regex/milestone/14) - [X] 2017-03-30 v0.11.1.0 [Fix the Haddocks](https://github.com/iconnect/regex/milestone/15) - [X] 2017-03-31 v0.12.0.0 [Move IsRegex into Text.RE](https://github.com/iconnect/regex/milestone/16) -- [ ] 2017-04-03 v1.0.0.0 [First stable release](https://github.com/iconnect/regex/milestone/3) +- [X] 2017-04-03 v0.13.0.0 [Protect findCaptureID and add Find, re-sort-imports](https://github.com/iconnect/regex/milestone/17) +- [ ] 2017-04-10 v1.0.0.0 [First stable release](https://github.com/iconnect/regex/milestone/3) - [ ] 2017-08-31 v2.0.0.0 [Fast text replacement with benchmarks](https://github.com/iconnect/regex/milestone/4) diff --git a/lib/md/tutorial.md b/lib/md/tutorial.md index 041f459..75c6717 100644 --- a/lib/md/tutorial.md +++ b/lib/md/tutorial.md @@ -1,7 +1,27 @@ -%heading#tutorial The regex Tutorial +%heading#tutorial The regex Tutorials -The [**regex tutorial**](re-tutorial) is a literate Haskell program with -interactive examples that can be tried out with ghci. +We have five tutorials, each of which is a literate Haskell program +with interactive examples that can be tried out with ghci. + + * The [**regex tutorial**](re-tutorial) covers basic usage only. + (**This tutorial has yet to be simplified.**) + + * The [**regex replacing tutorial**](re-tutorial-options) covers + the general regex replacement toolkit including a detailed look + at the `Matches` and `Match` types. (**This tutorial is just a + stub.**) + + * The [**regex options tutorial**](re-tutorial-replacing) covers + the different ways of specifying configuring RE parsing and + compilation. (**This tutorial is just a stub.**) + + * The [**regex tools tutorial**](re-tutorial-tools) looks at the + regex tools, including a detailed look at the `IsRegex` class. + (**This tutorial is just a stub.**) + + * The [**regex testbench tutorial**](re-tutorial-testbench) looks + at the regex test bench through the `re-nginx-log-processor` + example. (**This tutorial is just a stub.**) %heading#cabaltutorial Loading the Tutorial with Cabal diff --git a/lib/mega-regex.cabal b/lib/mega-regex.cabal index ad0877e..ec2a823 100644 --- a/lib/mega-regex.cabal +++ b/lib/mega-regex.cabal @@ -1,5 +1,5 @@ Name: regex -Version: 0.12.0.0 +Version: 0.13.0.0 Synopsis: Toolkit for regex-base Description: A regular expression toolkit for regex-base with compile-time checking of RE syntax, data types for @@ -63,7 +63,7 @@ Source-Repository head Source-Repository this Type: git Location: https://github.com/iconnect/regex.git - Tag: 0.12.0.0 + Tag: 0.13.0.0 @@ -89,13 +89,13 @@ Library Text.RE.TestBench Text.RE.Tools Text.RE.Tools.Edit + Text.RE.Tools.Find Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString - Text.RE.ZeInternals.Lex Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PCRE Text.RE.ZeInternals.PreludeMacros @@ -118,6 +118,8 @@ Library Text.RE.ZeInternals.SearchReplace.TDFAEdPrime Text.RE.ZeInternals.TDFA Text.RE.ZeInternals.TestBench + Text.RE.ZeInternals.TestBench.Parsers + Text.RE.ZeInternals.Tools.Lex Text.RE.ZeInternals.Types.Capture Text.RE.ZeInternals.Types.CaptureID Text.RE.ZeInternals.Types.IsRegex @@ -126,7 +128,6 @@ Library Text.RE.ZeInternals.Types.Matches Text.RE.ZeInternals.Types.SearchReplace - Default-Language: Haskell2010 Other-Extensions: @@ -195,7 +196,7 @@ Executable re-gen-cabals -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -225,7 +226,7 @@ Test-Suite re-gen-cabals-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -244,6 +245,9 @@ Executable re-gen-modules Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -252,7 +256,7 @@ Executable re-gen-modules -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -270,6 +274,9 @@ Test-Suite re-gen-modules-test Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -278,7 +285,7 @@ Test-Suite re-gen-modules-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -307,7 +314,7 @@ Executable re-include -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 @@ -333,7 +340,7 @@ Test-Suite re-include-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 @@ -348,6 +355,9 @@ Executable re-nginx-log-processor Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -356,7 +366,7 @@ Executable re-nginx-log-processor -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -379,6 +389,9 @@ Test-Suite re-nginx-log-processor-test Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -387,7 +400,7 @@ Test-Suite re-nginx-log-processor-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -421,11 +434,12 @@ Executable re-prep -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0 + , filepath , heredoc >= 0.2.0.0 , http-conduit >= 2.1.7.2 , shelly >= 1.6.1.2 @@ -449,11 +463,12 @@ Test-Suite re-prep-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0 + , filepath , heredoc >= 0.2.0.0 , http-conduit >= 2.1.7.2 , shelly >= 1.6.1.2 @@ -461,6 +476,60 @@ Test-Suite re-prep-test +Executable re-sort-imports + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , directory >= 1.2.1.0 + , filepath + , shelly >= 1.6.1.2 + , text >= 1.2.0.6 + + +Test-Suite re-sort-imports-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , directory >= 1.2.1.0 + , filepath + , shelly >= 1.6.1.2 + , text >= 1.2.0.6 + + + Executable re-tests Hs-Source-Dirs: examples @@ -477,7 +546,7 @@ Executable re-tests -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -517,7 +586,7 @@ Test-Suite re-tests-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -558,7 +627,7 @@ Executable re-tutorial -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -602,7 +671,7 @@ Test-Suite re-tutorial-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -648,7 +717,360 @@ Test-Suite re-tutorial-os-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-options + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-options-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-replacing + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-replacing-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-testbench + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-testbench-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-tools + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Test-Suite re-tutorial-tools-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 diff --git a/lib/regex-examples.cabal b/lib/regex-examples.cabal index 8468ec2..99da543 100644 --- a/lib/regex-examples.cabal +++ b/lib/regex-examples.cabal @@ -1,5 +1,5 @@ Name: regex-examples -Version: 0.12.0.0 +Version: 0.13.0.0 Synopsis: Tutorial, tests and example programs for regex Description: Tutorial, tests and example programs for regex, a Regular Expression Toolkit for regex-base with @@ -63,7 +63,7 @@ Source-Repository head Source-Repository this Type: git Location: https://github.com/iconnect/regex.git - Tag: 0.12.0.0 + Tag: 0.13.0.0 Executable re-gen-cabals @@ -82,7 +82,7 @@ Executable re-gen-cabals -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -112,7 +112,7 @@ Test-Suite re-gen-cabals-test -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -131,6 +131,9 @@ Executable re-gen-modules Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -139,7 +142,7 @@ Executable re-gen-modules -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -157,6 +160,9 @@ Test-Suite re-gen-modules-test Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -165,7 +171,7 @@ Test-Suite re-gen-modules-test -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -194,7 +200,7 @@ Executable re-include -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 @@ -220,7 +226,7 @@ Test-Suite re-include-test -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 @@ -235,6 +241,9 @@ Executable re-nginx-log-processor Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -243,8 +252,8 @@ Executable re-nginx-log-processor -Wwarn Build-depends: - regex == 0.12.0.0 - , regex-with-pcre == 0.12.0.0 + regex == 0.13.0.0 + , regex-with-pcre == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -267,6 +276,9 @@ Test-Suite re-nginx-log-processor-test Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -275,8 +287,8 @@ Test-Suite re-nginx-log-processor-test -Wwarn Build-depends: - regex == 0.12.0.0 - , regex-with-pcre == 0.12.0.0 + regex == 0.13.0.0 + , regex-with-pcre == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -310,11 +322,12 @@ Executable re-prep -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0 + , filepath , heredoc >= 0.2.0.0 , http-conduit >= 2.1.7.2 , shelly >= 1.6.1.2 @@ -338,11 +351,12 @@ Test-Suite re-prep-test -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0 + , filepath , heredoc >= 0.2.0.0 , http-conduit >= 2.1.7.2 , shelly >= 1.6.1.2 @@ -350,6 +364,60 @@ Test-Suite re-prep-test +Executable re-sort-imports + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , directory >= 1.2.1.0 + , filepath + , shelly >= 1.6.1.2 + , text >= 1.2.0.6 + + +Test-Suite re-sort-imports-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , directory >= 1.2.1.0 + , filepath + , shelly >= 1.6.1.2 + , text >= 1.2.0.6 + + + Executable re-tests Hs-Source-Dirs: examples @@ -366,8 +434,8 @@ Executable re-tests -Wwarn Build-depends: - regex == 0.12.0.0 - , regex-with-pcre == 0.12.0.0 + regex == 0.13.0.0 + , regex-with-pcre == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -407,8 +475,8 @@ Test-Suite re-tests-test -Wwarn Build-depends: - regex == 0.12.0.0 - , regex-with-pcre == 0.12.0.0 + regex == 0.13.0.0 + , regex-with-pcre == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -449,7 +517,7 @@ Executable re-tutorial -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -493,7 +561,7 @@ Test-Suite re-tutorial-test -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -539,7 +607,360 @@ Test-Suite re-tutorial-os-test -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-options + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-options-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-replacing + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-replacing-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-testbench + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-testbench-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-tools + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Test-Suite re-tutorial-tools-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Wwarn + + Build-depends: + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 diff --git a/lib/regex-with-pcre.cabal b/lib/regex-with-pcre.cabal index 03a812b..3ba747a 100644 --- a/lib/regex-with-pcre.cabal +++ b/lib/regex-with-pcre.cabal @@ -1,5 +1,5 @@ Name: regex-with-pcre -Version: 0.12.0.0 +Version: 0.13.0.0 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 head Source-Repository this Type: git Location: https://github.com/iconnect/regex.git - Tag: 0.12.0.0 + Tag: 0.13.0.0 @@ -87,7 +87,7 @@ Library -Wwarn Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 diff --git a/lib/regex.cabal b/lib/regex.cabal index 1ec91b7..6fe85ab 100644 --- a/lib/regex.cabal +++ b/lib/regex.cabal @@ -1,5 +1,5 @@ Name: regex -Version: 0.12.0.0 +Version: 0.13.0.0 Synopsis: Toolkit for regex-base Description: A regular expression toolkit for regex-base with compile-time checking of RE syntax, data types for @@ -32,14 +32,12 @@ Source-Repository head Source-Repository this Type: git Location: https://github.com/iconnect/regex.git - Tag: 0.12.0.0 - + Tag: 0.13.0.0 Library Hs-Source-Dirs: . - Exposed-Modules: Text.RE Text.RE.REOptions @@ -55,13 +53,13 @@ Library Text.RE.TestBench Text.RE.Tools Text.RE.Tools.Edit + Text.RE.Tools.Find Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString - Text.RE.ZeInternals.Lex Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PreludeMacros Text.RE.ZeInternals.QQ @@ -77,6 +75,8 @@ Library Text.RE.ZeInternals.SearchReplace.TDFAEdPrime Text.RE.ZeInternals.TDFA Text.RE.ZeInternals.TestBench + Text.RE.ZeInternals.TestBench.Parsers + Text.RE.ZeInternals.Tools.Lex Text.RE.ZeInternals.Types.Capture Text.RE.ZeInternals.Types.CaptureID Text.RE.ZeInternals.Types.IsRegex @@ -125,6 +125,7 @@ Library , containers >= 0.4 , hashable >= 1.2.3.3 , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 , regex-tdfa >= 1.2.0 , regex-tdfa-text >= 1.0.0.3 , template-haskell >= 2.7 diff --git a/lib/version.txt b/lib/version.txt index 4a947db..97ee894 100644 --- a/lib/version.txt +++ b/lib/version.txt @@ -1 +1 @@ -0.12.0.0 \ No newline at end of file +0.13.0.0 \ No newline at end of file diff --git a/regex.cabal b/regex.cabal index ad0877e..ec2a823 100644 --- a/regex.cabal +++ b/regex.cabal @@ -1,5 +1,5 @@ Name: regex -Version: 0.12.0.0 +Version: 0.13.0.0 Synopsis: Toolkit for regex-base Description: A regular expression toolkit for regex-base with compile-time checking of RE syntax, data types for @@ -63,7 +63,7 @@ Source-Repository head Source-Repository this Type: git Location: https://github.com/iconnect/regex.git - Tag: 0.12.0.0 + Tag: 0.13.0.0 @@ -89,13 +89,13 @@ Library Text.RE.TestBench Text.RE.Tools Text.RE.Tools.Edit + Text.RE.Tools.Find Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString - Text.RE.ZeInternals.Lex Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PCRE Text.RE.ZeInternals.PreludeMacros @@ -118,6 +118,8 @@ Library Text.RE.ZeInternals.SearchReplace.TDFAEdPrime Text.RE.ZeInternals.TDFA Text.RE.ZeInternals.TestBench + Text.RE.ZeInternals.TestBench.Parsers + Text.RE.ZeInternals.Tools.Lex Text.RE.ZeInternals.Types.Capture Text.RE.ZeInternals.Types.CaptureID Text.RE.ZeInternals.Types.IsRegex @@ -126,7 +128,6 @@ Library Text.RE.ZeInternals.Types.Matches Text.RE.ZeInternals.Types.SearchReplace - Default-Language: Haskell2010 Other-Extensions: @@ -195,7 +196,7 @@ Executable re-gen-cabals -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -225,7 +226,7 @@ Test-Suite re-gen-cabals-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -244,6 +245,9 @@ Executable re-gen-modules Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -252,7 +256,7 @@ Executable re-gen-modules -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -270,6 +274,9 @@ Test-Suite re-gen-modules-test Main-Is: re-gen-modules.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -278,7 +285,7 @@ Test-Suite re-gen-modules-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -307,7 +314,7 @@ Executable re-include -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 @@ -333,7 +340,7 @@ Test-Suite re-include-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 @@ -348,6 +355,9 @@ Executable re-nginx-log-processor Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -356,7 +366,7 @@ Executable re-nginx-log-processor -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -379,6 +389,9 @@ Test-Suite re-nginx-log-processor-test Main-Is: re-nginx-log-processor.lhs + Other-Modules: + TestKit + Default-Language: Haskell2010 GHC-Options: @@ -387,7 +400,7 @@ Test-Suite re-nginx-log-processor-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -421,11 +434,12 @@ Executable re-prep -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0 + , filepath , heredoc >= 0.2.0.0 , http-conduit >= 2.1.7.2 , shelly >= 1.6.1.2 @@ -449,11 +463,12 @@ Test-Suite re-prep-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0 + , filepath , heredoc >= 0.2.0.0 , http-conduit >= 2.1.7.2 , shelly >= 1.6.1.2 @@ -461,6 +476,60 @@ Test-Suite re-prep-test +Executable re-sort-imports + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , directory >= 1.2.1.0 + , filepath + , shelly >= 1.6.1.2 + , text >= 1.2.0.6 + + +Test-Suite re-sort-imports-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-sort-imports.lhs + + Other-Modules: + TestKit + + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , directory >= 1.2.1.0 + , filepath + , shelly >= 1.6.1.2 + , text >= 1.2.0.6 + + + Executable re-tests Hs-Source-Dirs: examples @@ -477,7 +546,7 @@ Executable re-tests -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -517,7 +586,7 @@ Test-Suite re-tests-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -558,7 +627,7 @@ Executable re-tutorial -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -602,7 +671,7 @@ Test-Suite re-tutorial-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 @@ -648,7 +717,360 @@ Test-Suite re-tutorial-os-test -Werror Build-depends: - regex == 0.12.0.0 + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-options + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-options-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-options.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-replacing + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-replacing-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-replacing.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-testbench + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + +Test-Suite re-tutorial-testbench-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-testbench.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Executable re-tutorial-tools + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 + , array >= 0.4 + , base >= 4 && < 5 + , base-compat >= 0.6.0 + , bytestring >= 0.10.2.0 + , containers >= 0.4 + , directory >= 1.2.1.0 + , hashable >= 1.2.3.3 + , heredoc >= 0.2.0.0 + , regex-base >= 0.93.2 + , regex-pcre-builtin >= 0.94.4.8.8.35 + , regex-tdfa >= 1.2.0 + , regex-tdfa-text >= 1.0.0.3 + , shelly >= 1.6.1.2 + , smallcheck >= 1.1.1 + , tasty >= 0.10.1.2 + , tasty-hunit >= 0.9.2 + , tasty-smallcheck >= 0.8.0.1 + , template-haskell >= 2.7 + , text >= 1.2.0.6 + , time >= 1.4.2 + , time-locale-compat >= 0.1.0.1 + , transformers >= 0.2.2 + , unordered-containers >= 0.2.5.1 + + + +Test-Suite re-tutorial-tools-test + type: exitcode-stdio-1.0 + Hs-Source-Dirs: examples + + Main-Is: re-tutorial-tools.lhs + + Other-Modules: + TestKit + + Default-Extensions: QuasiQuotes + Default-Language: Haskell2010 + + GHC-Options: + -Wall + -fwarn-tabs + -Werror + + Build-depends: + regex == 0.13.0.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 diff --git a/releases/regex-0.13.0.0.tar.gz b/releases/regex-0.13.0.0.tar.gz new file mode 100644 index 0000000..ab676b2 Binary files /dev/null and b/releases/regex-0.13.0.0.tar.gz differ diff --git a/releases/regex-examples-0.13.0.0.tar.gz b/releases/regex-examples-0.13.0.0.tar.gz new file mode 100644 index 0000000..f4eaeee Binary files /dev/null and b/releases/regex-examples-0.13.0.0.tar.gz differ diff --git a/releases/regex-with-pcre-0.13.0.0.tar.gz b/releases/regex-with-pcre-0.13.0.0.tar.gz new file mode 100644 index 0000000..a55470b Binary files /dev/null and b/releases/regex-with-pcre-0.13.0.0.tar.gz differ