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
39ee2257
Commit
39ee2257
authored
Feb 11, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for multi-line defines
parent
cb42f37b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
Language/SystemVerilog/Parser/Preprocess.hs
+15
-12
No files found.
Language/SystemVerilog/Parser/Preprocess.hs
View file @
39ee2257
...
...
@@ -48,18 +48,21 @@ preprocess env file content = unlines $ pp True [] env $ lines $ uncomment file
where
pp
::
Bool
->
[
Bool
]
->
[(
String
,
String
)]
->
[
String
]
->
[
String
]
pp
_
_
_
[]
=
[]
pp
on
stack
env
(
a
:
rest
)
=
case
words
a
of
"`define"
:
name
:
value
->
""
:
pp
on
stack
(
if
on
then
(
name
,
ppLine
env
$
unwords
value
)
:
env
else
env
)
rest
"`ifdef"
:
name
:
_
->
""
:
pp
(
on
&&
(
elem
name
$
fst
$
unzip
env
))
(
on
:
stack
)
env
rest
"`ifndef"
:
name
:
_
->
""
:
pp
(
on
&&
(
notElem
name
$
fst
$
unzip
env
))
(
on
:
stack
)
env
rest
"`else"
:
_
|
not
$
null
stack
->
""
:
pp
(
head
stack
&&
not
on
)
stack
env
rest
|
otherwise
->
error
$
"`else without associated `ifdef/`ifndef: "
++
file
"`endif"
:
_
|
not
$
null
stack
->
""
:
pp
(
head
stack
)
(
tail
stack
)
env
rest
|
otherwise
->
error
$
"`endif without associated `ifdef/`ifndef: "
++
file
"`default_nettype"
:
_
->
""
:
pp
on
stack
env
rest
_
->
(
if
on
then
ppLine
env
a
else
""
)
:
pp
on
stack
env
rest
pp
on
stack
env
(
a
:
rest
)
=
if
a
/=
""
&&
last
a
==
'
\\
'
&
&
head
a
==
'`'
then
pp
on
stack
env
$
((
init
a
)
++
" "
++
(
head
rest
))
:
(
tail
rest
)
else
case
words
a
of
"`define"
:
name
:
value
->
""
:
pp
on
stack
(
if
on
then
(
name
,
ppLine
env
$
unwords
value
)
:
env
else
env
)
rest
"`ifdef"
:
name
:
_
->
""
:
pp
(
on
&&
(
elem
name
$
fst
$
unzip
env
))
(
on
:
stack
)
env
rest
"`ifndef"
:
name
:
_
->
""
:
pp
(
on
&&
(
notElem
name
$
fst
$
unzip
env
))
(
on
:
stack
)
env
rest
"`else"
:
_
|
not
$
null
stack
->
""
:
pp
(
head
stack
&&
not
on
)
stack
env
rest
|
otherwise
->
error
$
"`else without associated `ifdef/`ifndef: "
++
file
"`endif"
:
_
|
not
$
null
stack
->
""
:
pp
(
head
stack
)
(
tail
stack
)
env
rest
|
otherwise
->
error
$
"`endif without associated `ifdef/`ifndef: "
++
file
"`default_nettype"
:
_
->
""
:
pp
on
stack
env
rest
_
->
(
if
on
then
ppLine
env
a
else
""
)
:
pp
on
stack
env
rest
ppLine
::
[(
String
,
String
)]
->
String
->
String
ppLine
_
""
=
""
...
...
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