@@ -1,24 +1,15 @@
1module Data.Schematic.Generator.Regex where
1module Data.Schematic.Generator.Regex where
3import Control.Monad
3import Control.Monad
4−import Data.Aeson (Object, Value(..))
5−import Data.HashMap.Lazy (HashMap)
6−import qualified Data.HashMap.Lazy as H
7import Data.List
4import Data.List
8import Data.Maybe
5import Data.Maybe
10−import Data.Schematic.Schema
11import qualified Data.Set as S
6import qualified Data.Set as S
12−import Data.Text (Text, pack, unpack)
7+import Data.Text (Text, unpack)
13import Data.Text.Lazy (toStrict)
8import Data.Text.Lazy (toStrict)
14import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
9import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
15−import qualified Data.Vector as V
16−import Test.SmallCheck
17import Test.SmallCheck.Series
10import Test.SmallCheck.Series
18−import Text.Regex.TDFA
19import Text.Regex.TDFA.Pattern
11import Text.Regex.TDFA.Pattern
20import Text.Regex.TDFA.ReadRegex (parseRegex)
12import Text.Regex.TDFA.ReadRegex (parseRegex)
21−import Data.Schematic.Verifier
24minRepeat :: Int
15minRepeat :: Int
@@ -34,8 +25,8 @@ regexSeries regexp =
34 Left _ -> pure ""
25 Left _ -> pure ""
36regexSeries' :: (Monad m) => Pattern -> Series m Builder
27regexSeries' :: (Monad m) => Pattern -> Series m Builder
37−regexSeries' p =
28+regexSeries' pt =
38− case p of
29+ case pt of
39 PEmpty -> pure mempty
30 PEmpty -> pure mempty
40 PChar {..} -> pure $ singleton getPatternChar
31 PChar {..} -> pure $ singleton getPatternChar
41 PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> do
32 PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> do
@@ -82,4 +73,4 @@ regexSeries' p =
82 'D' -> notChars $ ['0' .. '9']
73 'D' -> notChars $ ['0' .. '9']
83 'W' -> notChars $ ['0' .. '9'] ++ '_' : ['a' .. 'z'] ++ ['A' .. 'Z']
74 'W' -> notChars $ ['0' .. '9'] ++ '_' : ['a' .. 'z'] ++ ['A' .. 'Z']
84 'S' -> notChars "\9\32"
75 'S' -> notChars "\9\32"
85− ch -> [ch]
76+ ch' -> [ch']