aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/VeriFuzz/Gen.hs1
-rw-r--r--src/VeriFuzz/Parser/Parser.hs31
-rw-r--r--verifuzz.cabal2
3 files changed, 8 insertions, 26 deletions
diff --git a/src/VeriFuzz/Gen.hs b/src/VeriFuzz/Gen.hs
index f7baa12..c3f2360 100644
--- a/src/VeriFuzz/Gen.hs
+++ b/src/VeriFuzz/Gen.hs
@@ -31,7 +31,6 @@ import Test.QuickCheck (Gen)
import qualified Test.QuickCheck as QC
import VeriFuzz.AST
import VeriFuzz.ASTGen
-import VeriFuzz.CodeGen
import VeriFuzz.Config
import VeriFuzz.Internal
import VeriFuzz.Mutate
diff --git a/src/VeriFuzz/Parser/Parser.hs b/src/VeriFuzz/Parser/Parser.hs
index 4ba36e2..084cfe2 100644
--- a/src/VeriFuzz/Parser/Parser.hs
+++ b/src/VeriFuzz/Parser/Parser.hs
@@ -42,9 +42,7 @@ type Parser = Parsec [Token] ()
type ParseOperator = Operator [Token] () Identity
-data Decimal = Decimal { size :: Int
- , num :: Integer
- }
+data Decimal = Decimal Int Integer
instance Num Decimal where
(Decimal sa na) + (Decimal sb nb) = Decimal (max sa sb) (na + nb)
@@ -81,9 +79,6 @@ tok' p = tok p >> return ()
parens :: Parser a -> Parser a
parens = between (tok SymParenL) (tok SymParenR)
-brackets :: Parser a -> Parser a
-brackets = between (tok SymBrackL) (tok SymBrackR)
-
braces :: Parser a -> Parser a
braces = between (tok SymBraceL) (tok SymBraceR)
@@ -93,18 +88,6 @@ sBinOp = sOp BinOp where sOp f b a = f a b
parseExpr' :: Parser Expr
parseExpr' = buildExpressionParser parseTable parseTerm <?> "expr"
-matchHex :: Char -> Bool
-matchHex c = c == 'h' || c == 'H'
-
---matchBin :: Char -> Bool
---matchBin c = c == 'b' || c == 'B'
-
-matchDec :: Char -> Bool
-matchDec c = c == 'd' || c == 'D'
-
-matchOct :: Char -> Bool
-matchOct c = c == 'o' || c == 'O'
-
decToExpr :: Decimal -> Expr
decToExpr (Decimal s n) = Number s n
@@ -219,7 +202,7 @@ parseContAssign :: Parser ContAssign
parseContAssign = do
var <- tok KWAssign *> identifier
expr <- tok SymEq *> parseExpr
- tok SymSemi
+ tok' SymSemi
return $ ContAssign var expr
numLit :: Parser String
@@ -240,11 +223,11 @@ number = number' <$> numLit
where
w = takeWhile (/= '\'') a
b = dropWhile (/= '\'') a
- f a
- | isPrefixOf "'d" a = read $ drop 2 a
- | isPrefixOf "'h" a = read $ "0x" ++ drop 2 a
- | isPrefixOf "'b" a = foldl (\ n b -> shiftL n 1 .|. (if b == '1' then 1 else 0)) 0 (drop 2 a)
- | otherwise = error $ "Invalid number format: " ++ a
+ f a'
+ | isPrefixOf "'d" a' = read $ drop 2 a'
+ | isPrefixOf "'h" a' = read $ "0x" ++ drop 2 a'
+ | isPrefixOf "'b" a' = foldl (\ n b' -> shiftL n 1 .|. (if b' == '1' then 1 else 0)) 0 (drop 2 a')
+ | otherwise = error $ "Invalid number format: " ++ a'
toInteger' :: Decimal -> Integer
toInteger' (Decimal _ n) = n
diff --git a/verifuzz.cabal b/verifuzz.cabal
index 39bc1fd..5e92c68 100644
--- a/verifuzz.cabal
+++ b/verifuzz.cabal
@@ -19,7 +19,7 @@ extra-source-files: README.md
library
hs-source-dirs: src
default-language: Haskell2010
- ghc-options: -Wall
+ ghc-options: -Wall -Werror
build-tools: alex >=3 && <4
exposed-modules: VeriFuzz
, VeriFuzz.AST