aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Verilog/Preprocess.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-04-09 12:38:15 +0100
committerYann Herklotz <git@ymhg.org>2019-04-09 12:38:15 +0100
commitd350cd339797c6dd9056afa2b1dad5aed4c31cb9 (patch)
tree868474f18dfedc05d347cf16d09b5e770bc33293 /src/VeriFuzz/Verilog/Preprocess.hs
parent7653f8fd33162b8b166a12e125c988663ec2fe79 (diff)
downloadverismith-d350cd339797c6dd9056afa2b1dad5aed4c31cb9.tar.gz
verismith-d350cd339797c6dd9056afa2b1dad5aed4c31cb9.zip
Add Parameter type and remove Description
Diffstat (limited to 'src/VeriFuzz/Verilog/Preprocess.hs')
-rw-r--r--src/VeriFuzz/Verilog/Preprocess.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/VeriFuzz/Verilog/Preprocess.hs b/src/VeriFuzz/Verilog/Preprocess.hs
index fead5f0..6e9305a 100644
--- a/src/VeriFuzz/Verilog/Preprocess.hs
+++ b/src/VeriFuzz/Verilog/Preprocess.hs
@@ -20,7 +20,9 @@ module VeriFuzz.Verilog.Preprocess
)
where
--- | Remove comments from code.
+-- | Remove comments from code. There is no difference between @(* *)@ and
+-- @/* */@, therefore in this implementation, @*/@ could close @(*@ and vice-versa,
+-- This will be fixed in an upcoming version.
uncomment :: FilePath -> String -> String
uncomment file = uncomment'
where
@@ -28,6 +30,7 @@ uncomment file = uncomment'
"" -> ""
'/' : '/' : rest -> " " ++ removeEOL rest
'/' : '*' : rest -> " " ++ remove rest
+ '(' : '*' : rest -> " " ++ remove rest
'"' : rest -> '"' : ignoreString rest
b : rest -> b : uncomment' rest
@@ -43,6 +46,7 @@ uncomment file = uncomment'
'\n' : rest -> '\n' : remove rest
'\t' : rest -> '\t' : remove rest
'*' : '/' : rest -> " " ++ uncomment' rest
+ '*' : ')' : rest -> " " ++ uncomment' rest
_ : rest -> " " ++ remove rest
removeString a = case a of
@@ -105,4 +109,3 @@ ppLine env ('`' : a) = case lookup name env of
a
rest = drop (length name) a
ppLine env (a : b) = a : ppLine env b
-