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
e915ea6f
Commit
e915ea6f
authored
Oct 28, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vhdl_parser.py: minor simplification.
parent
a3cb3858
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
14 deletions
+7
-14
vhdl_parser.py
hdlmake/sourcefiles/vhdl_parser.py
+7
-14
No files found.
hdlmake/sourcefiles/vhdl_parser.py
View file @
e915ea6f
...
@@ -47,22 +47,15 @@ class VHDLParser(DepParser):
...
@@ -47,22 +47,15 @@ class VHDLParser(DepParser):
def
_preprocess
(
vhdl_file
):
def
_preprocess
(
vhdl_file
):
"""Preprocess the supplied VHDL file instance"""
"""Preprocess the supplied VHDL file instance"""
def
_preprocess_file
(
file_content
,
file_name
,
library
):
"""Preprocess the suplied string using the arguments"""
def
_remove_comments_and_strings
(
text
):
"""Remove the comments and strings from the VHDL code"""
pattern
=
re
.
compile
(
'--.*?$|".?"'
,
re
.
DOTALL
|
re
.
MULTILINE
)
return
re
.
sub
(
pattern
,
""
,
text
)
logging
.
debug
(
"preprocess file
%
s (of length
%
d) in library
%
s"
,
file_name
,
len
(
file_content
),
library
)
return
_remove_comments_and_strings
(
file_content
)
file_path
=
vhdl_file
.
file_path
file_path
=
vhdl_file
.
file_path
buf
=
open
(
file_path
,
"r"
)
.
read
()
buf
=
open
(
file_path
,
"r"
)
.
read
()
return
_preprocess_file
(
file_content
=
buf
,
logging
.
debug
(
file_name
=
file_path
,
"preprocess file
%
s (of length
%
d) in library
%
s"
,
library
=
vhdl_file
.
library
)
file_path
,
len
(
buf
),
vhdl_file
.
library
)
# Remove the comments and strings from the VHDL code
pattern
=
re
.
compile
(
'--.*?$|".?"'
,
re
.
DOTALL
|
re
.
MULTILINE
)
return
re
.
sub
(
pattern
,
""
,
buf
)
buf
=
_preprocess
(
dep_file
)
buf
=
_preprocess
(
dep_file
)
# use packages
# use packages
use_pattern
=
re
.
compile
(
use_pattern
=
re
.
compile
(
...
...
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