Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
9f8c7189
Commit
9f8c7189
authored
Oct 29, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlog_parser.py: cleanup.
parent
c894f8f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
vlog_parser.py
hdlmake/sourcefiles/vlog_parser.py
+3
-7
No files found.
hdlmake/sourcefiles/vlog_parser.py
View file @
9f8c7189
...
...
@@ -108,14 +108,12 @@ class VerilogPreprocessor(object):
def
_munge_list
(
flist
):
'''Take the split list & normalize into a list of string literals & seperator matches'''
if
not
flist
:
return
[]
assert
flist
is_match
=
False
# if nothing was present, split inserts an empty element
rlist
=
[]
while
flist
:
if
is_match
:
if
len
(
flist
)
<
9
:
raise
Exception
(
"_munge_list: insufficient arguments for match object"
)
assert
len
(
flist
)
>=
9
,
"_munge_list: insufficient arguments for match object"
rlist
.
append
(
vpp_match
(
flist
[
0
],
flist
[
1
],
None
if
not
flist
[
2
]
else
flist
[
2
]
.
strip
(),
flist
[
3
],
flist
[
4
],
''
if
not
flist
[
5
]
else
flist
[
5
]
.
replace
(
'
\\\n
'
,
''
),
flist
[
6
],
flist
[
7
]))
flist
=
flist
[
9
:]
...
...
@@ -125,7 +123,7 @@ class VerilogPreprocessor(object):
return
rlist
def
_tok_string
(
text
):
toks
=
re
.
split
(
r'
''((?:`(ifn?def|elsif|else|endif|define|include)((?<=ifdef\b)\s+(?:\w+)|(?<=ifndef\b)\s+(?:\w+)|(?<=elsif\b)\s+(?:\w+)|(?:(?<=define\b)\s+(\w+)(?:\(([\w\s,]*)\))?[ \t]*((?:\\\n|[^\n\r])*)$)|(?<=include\b)\s+"(.+?)")?)|(?:`(\w+)(?:\(([\w\s,]*)\))?))''
'
,
text
,
flags
=
re
.
MULTILINE
)
toks
=
re
.
split
(
r'
((?:`(ifn?def|elsif|else|endif|define|include)((?<=ifdef\b)\s+(?:\w+)|(?<=ifndef\b)\s+(?:\w+)|(?<=elsif\b)\s+(?:\w+)|(?:(?<=define\b)\s+(\w+)(?:\(([\w\s,]*)\))?[ \t]*((?:\\\n|[^\n\r])*)$)|(?<=include\b)\s+"(.+?)")?)|(?:`(\w+)(?:\(([\w\s,]*)\))?))
'
,
text
,
flags
=
re
.
MULTILINE
)
return
_munge_list
(
toks
)
parts
=
_tok_string
(
text
)
...
...
@@ -169,8 +167,6 @@ class VerilogPreprocessor(object):
elif
front
.
pptype
==
'elsif'
:
if
not
handled
:
enabled
=
front
.
ppident
in
lmacros
if
front
.
pptype
==
'ifndef'
:
enabled
=
not
enabled
handled
=
enabled
else
:
# if a clause was already selected, skip this one
enabled
=
False
...
...
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