aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriSmith/Verilog/Quote.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2019-09-18 19:06:32 +0200
committerYann Herklotz <git@yannherklotz.com>2019-09-18 19:06:32 +0200
commit8d96fd2a541a2602544ced741552ebd17714c67d (patch)
tree2f53addec05793cf5b3e0274a3e8e9e5f76a7abe /src/VeriSmith/Verilog/Quote.hs
parentd14196cce14d1b4a4a9fba768b9f5238c8626624 (diff)
downloadverismith-8d96fd2a541a2602544ced741552ebd17714c67d.tar.gz
verismith-8d96fd2a541a2602544ced741552ebd17714c67d.zip
Rename main modules
Diffstat (limited to 'src/VeriSmith/Verilog/Quote.hs')
-rw-r--r--src/VeriSmith/Verilog/Quote.hs50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/VeriSmith/Verilog/Quote.hs b/src/VeriSmith/Verilog/Quote.hs
deleted file mode 100644
index 3815fe6..0000000
--- a/src/VeriSmith/Verilog/Quote.hs
+++ /dev/null
@@ -1,50 +0,0 @@
-{-|
-Module : VeriSmith.Verilog.Quote
-Description : QuasiQuotation for verilog code in Haskell.
-Copyright : (c) 2019, Yann Herklotz Grave
-License : GPL-3
-Maintainer : yann [at] yannherklotz [dot] com
-Stability : experimental
-Portability : POSIX
-
-QuasiQuotation for verilog code in Haskell.
--}
-
-{-# LANGUAGE TemplateHaskell #-}
-
-module VeriSmith.Verilog.Quote
- ( verilog
- )
-where
-
-import Data.Data
-import qualified Data.Text as T
-import qualified Language.Haskell.TH as TH
-import Language.Haskell.TH.Quote
-import Language.Haskell.TH.Syntax
-import VeriSmith.Verilog.Parser
-
-liftDataWithText :: Data a => a -> Q Exp
-liftDataWithText = dataToExpQ $ fmap liftText . cast
-
-liftText :: T.Text -> Q Exp
-liftText txt = AppE (VarE 'T.pack) <$> lift (T.unpack txt)
-
--- | Quasiquoter for verilog, so that verilog can be written inline and be
--- parsed to an AST at compile time.
-verilog :: QuasiQuoter
-verilog = QuasiQuoter
- { quoteExp = quoteVerilog
- , quotePat = undefined
- , quoteType = undefined
- , quoteDec = undefined
- }
-
-quoteVerilog :: String -> TH.Q TH.Exp
-quoteVerilog s = do
- loc <- TH.location
- let pos = T.pack $ TH.loc_filename loc
- v <- case parseVerilog pos (T.pack s) of
- Right e -> return e
- Left e -> fail $ show e
- liftDataWithText v