Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
f11f1efe
Commit
f11f1efe
authored
Feb 18, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address warnings in Preprocess.hs
parent
4762d40f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
Language/SystemVerilog/Parser/Preprocess.hs
+9
-8
No files found.
Language/SystemVerilog/Parser/Preprocess.hs
View file @
f11f1efe
...
...
@@ -5,18 +5,18 @@ module Language.SystemVerilog.Parser.Preprocess
-- | Remove comments from code.
uncomment
::
FilePath
->
String
->
String
uncomment
file
a
=
uncomment
a
uncomment
file
str
=
uncomment'
str
where
uncomment
a
=
case
a
of
uncomment
'
a
=
case
a
of
""
->
""
'/'
:
'/'
:
rest
->
" "
++
removeEOL
rest
'/'
:
'*'
:
rest
->
" "
++
remove
rest
'"'
:
rest
->
'"'
:
ignoreString
rest
a
:
rest
->
a
:
uncomment
rest
ch
:
rest
->
ch
:
uncomment'
rest
removeEOL
a
=
case
a
of
""
->
""
'
\n
'
:
rest
->
'
\n
'
:
uncomment
rest
'
\n
'
:
rest
->
'
\n
'
:
uncomment
'
rest
'
\t
'
:
rest
->
'
\t
'
:
removeEOL
rest
_
:
rest
->
' '
:
removeEOL
rest
...
...
@@ -25,7 +25,7 @@ uncomment file a = uncomment a
'"'
:
rest
->
removeString
rest
'
\n
'
:
rest
->
'
\n
'
:
remove
rest
'
\t
'
:
rest
->
'
\t
'
:
remove
rest
'*'
:
'/'
:
rest
->
" "
++
uncomment
rest
'*'
:
'/'
:
rest
->
" "
++
uncomment
'
rest
_
:
rest
->
" "
++
remove
rest
removeString
a
=
case
a
of
...
...
@@ -38,17 +38,18 @@ uncomment file a = uncomment a
ignoreString
a
=
case
a
of
""
->
error
$
"File ended without closing string: "
++
file
'"'
:
rest
->
'"'
:
uncomment
rest
'"'
:
rest
->
'"'
:
uncomment
'
rest
'
\\
'
:
'"'
:
rest
->
"
\\\"
"
++
ignoreString
rest
a
:
rest
->
a
:
ignoreString
rest
ch
:
rest
->
ch
:
ignoreString
rest
-- | A simple `define preprocessor.
preprocess
::
[(
String
,
String
)]
->
FilePath
->
String
->
String
preprocess
env
file
content
=
unlines
$
pp
True
[]
env
$
lines
$
uncomment
file
content
preprocess
_env
file
content
=
unlines
$
pp
True
[]
_
env
$
lines
$
uncomment
file
content
where
pp
::
Bool
->
[
Bool
]
->
[(
String
,
String
)]
->
[
String
]
->
[
String
]
pp
_
_
_
[]
=
[]
pp
on
stack
env
(
a
:
rest
)
=
-- handle macros with escaped newlines
if
a
/=
""
&&
last
a
==
'
\\
'
&
&
head
a
==
'`'
then
""
:
(
pp
on
stack
env
$
((
init
a
)
++
" "
++
(
head
rest
))
:
(
tail
rest
))
else
case
words
a
of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment