@@ -19,8 +19,9 @@ import Parse.Parser
1919
2020import Debug.Trace
2121
22−import Util.Stringable
22+import Util.Arbs
2323import Util.CharGens
24+import Util.Stringable
2425
2526
2627main :: IO ()
@@ -37,45 +38,6 @@ tests = [
3738 ]
3839 ]
3940
40−
41−newtype ValidIdent = ValidIdent String deriving (Eq, Show)
42−
43−instance Stringable ValidIdent where
44− stringify (ValidIdent v) = v
45−
46−instance Arbitrary ValidIdent where
47− arbitrary = ValidIdent <$> ((:) <$> lowerAlpha <*> (listOf alphaNumUnderPrime))
48−
49−
50−newtype StringValue = StringValue String deriving (Eq, Show)
51−
52−instance Stringable StringValue where
53− stringify (StringValue v) = v
54−
55−instance Arbitrary StringValue where
56− arbitrary = StringValue <$> escape <$> arbitrary
57−
58−
59−newtype InvalidIdentChar = InvalidIdentChar Char deriving (Eq, Show)
60−
61−instance Stringable InvalidIdentChar where
62− stringify (InvalidIdentChar c) = [c]
63−
64−instance Arbitrary InvalidIdentChar where
65− arbitrary = InvalidIdentChar <$> elements "!@#$%^&*()-=+\\|/?.>,<`~"
66−
67−
68−replace' :: String -> String -> String -> String
69−replace' a b c = unpack $ replace (pack a) (pack b) (pack c)
70−
71−escape :: String -> String
72−escape =
73− (replace' "\n" "\\n") .
74− (replace' "\t" "\\t") .
75− (replace' "\"" "\\\"") .
76− (replace' "\\" "\\\\")
77−
78−
7941-- TODO: variable whitespace?
8042prop_assignString :: ValidIdent -> StringValue -> Bool
8143prop_assignString vi sv =