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
2347f124
Commit
2347f124
authored
Jun 12, 2017
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a less agressive but more formal VHDL parsing approach
parent
0ded0fa7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
dep_file.py
hdlmake/dep_file.py
+1
-1
vhdl_parser.py
hdlmake/vhdl_parser.py
+19
-15
No files found.
hdlmake/dep_file.py
View file @
2347f124
...
@@ -43,7 +43,7 @@ class DepRelation(object):
...
@@ -43,7 +43,7 @@ class DepRelation(object):
PACKAGE
=
2
PACKAGE
=
2
INCLUDE
=
3
INCLUDE
=
3
ARCHITECTURE
=
4
ARCHITECTURE
=
4
MODULE
=
ARCHITECTURE
MODULE
=
ENTITY
def
__init__
(
self
,
obj_name
,
direction
,
rel_type
):
def
__init__
(
self
,
obj_name
,
direction
,
rel_type
):
assert
direction
in
[
DepRelation
.
PROVIDE
,
DepRelation
.
USE
]
assert
direction
in
[
DepRelation
.
PROVIDE
,
DepRelation
.
USE
]
...
...
hdlmake/vhdl_parser.py
View file @
2347f124
...
@@ -107,6 +107,10 @@ class VHDLParser(DepParser):
...
@@ -107,6 +107,10 @@ class VHDLParser(DepParser):
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
1
)),
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
1
)),
DepRelation
.
PROVIDE
,
DepRelation
.
PROVIDE
,
DepRelation
.
ENTITY
))
DepRelation
.
ENTITY
))
dep_file
.
add_relation
(
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
1
)),
DepRelation
.
USE
,
DepRelation
.
ARCHITECTURE
))
return
"<hdlmake entity_pattern
%
s.
%
s>"
%
(
dep_file
.
library
,
return
"<hdlmake entity_pattern
%
s.
%
s>"
%
(
dep_file
.
library
,
text
.
group
(
1
))
text
.
group
(
1
))
...
@@ -132,10 +136,6 @@ class VHDLParser(DepParser):
...
@@ -132,10 +136,6 @@ class VHDLParser(DepParser):
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
2
)),
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
2
)),
DepRelation
.
PROVIDE
,
DepRelation
.
PROVIDE
,
DepRelation
.
ARCHITECTURE
))
DepRelation
.
ARCHITECTURE
))
dep_file
.
add_relation
(
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
2
)),
DepRelation
.
USE
,
DepRelation
.
ENTITY
))
return
"<hdlmake architecture
%
s.
%
s>"
%
(
dep_file
.
library
,
return
"<hdlmake architecture
%
s.
%
s>"
%
(
dep_file
.
library
,
text
.
group
(
2
))
text
.
group
(
2
))
buf
=
re
.
sub
(
architecture_split_pattern
,
do_architecture
,
buf
)
buf
=
re
.
sub
(
architecture_split_pattern
,
do_architecture
,
buf
)
...
@@ -171,6 +171,10 @@ class VHDLParser(DepParser):
...
@@ -171,6 +171,10 @@ class VHDLParser(DepParser):
matches as indexed plain strings. It doesn't add any relation
matches as indexed plain strings. It doesn't add any relation
to the file"""
to the file"""
logging
.
debug
(
"found component declaration
%
s"
,
text
.
group
(
1
))
logging
.
debug
(
"found component declaration
%
s"
,
text
.
group
(
1
))
dep_file
.
add_relation
(
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
1
)),
DepRelation
.
USE
,
DepRelation
.
ENTITY
))
return
"<hdlmake component
%
s>"
%
text
.
group
(
1
)
return
"<hdlmake component
%
s>"
%
text
.
group
(
1
)
buf
=
re
.
sub
(
component_pattern
,
do_component
,
buf
)
buf
=
re
.
sub
(
component_pattern
,
do_component
,
buf
)
...
@@ -252,9 +256,9 @@ class VHDLParser(DepParser):
...
@@ -252,9 +256,9 @@ class VHDLParser(DepParser):
for
lib
in
libraries
:
for
lib
in
libraries
:
logging
.
debug
(
"-> instantiates
%
s.
%
s as
%
s"
,
logging
.
debug
(
"-> instantiates
%
s.
%
s as
%
s"
,
lib
,
text
.
group
(
2
),
text
.
group
(
1
))
lib
,
text
.
group
(
2
),
text
.
group
(
1
))
dep_file
.
add_relation
(
DepRelation
(
#
dep_file.add_relation(DepRelation(
"
%
s.
%
s"
%
(
lib
,
text
.
group
(
2
)),
#
"%s.%s" % (lib, text.group(2)),
DepRelation
.
USE
,
DepRelation
.
ARCHITECTURE
))
#
DepRelation.USE, DepRelation.ARCHITECTURE))
return
"<hdlmake instance
%
s|
%
s>"
%
(
text
.
group
(
1
),
return
"<hdlmake instance
%
s|
%
s>"
%
(
text
.
group
(
1
),
text
.
group
(
2
))
text
.
group
(
2
))
buf
=
re
.
sub
(
instance_pattern
,
do_instance
,
buf
)
buf
=
re
.
sub
(
instance_pattern
,
do_instance
,
buf
)
...
@@ -272,17 +276,17 @@ class VHDLParser(DepParser):
...
@@ -272,17 +276,17 @@ class VHDLParser(DepParser):
if
text
.
group
(
2
)
.
lower
()
==
"work"
:
if
text
.
group
(
2
)
.
lower
()
==
"work"
:
logging
.
debug
(
"-> instantiates
%
s.
%
s as
%
s"
,
logging
.
debug
(
"-> instantiates
%
s.
%
s as
%
s"
,
dep_file
.
library
,
text
.
group
(
3
),
text
.
group
(
1
))
dep_file
.
library
,
text
.
group
(
3
),
text
.
group
(
1
))
dep_file
.
add_relation
(
#
dep_file.add_relation(
DepRelation
(
"
%
s.
%
s"
%
(
dep_file
.
library
,
text
.
group
(
3
)),
#
DepRelation("%s.%s" % (dep_file.library, text.group(3)),
DepRelation
.
USE
,
#
DepRelation.USE,
DepRelation
.
ARCHITECTURE
))
#
DepRelation.ARCHITECTURE))
else
:
else
:
logging
.
debug
(
"-> instantiates
%
s.
%
s as
%
s"
,
logging
.
debug
(
"-> instantiates
%
s.
%
s as
%
s"
,
text
.
group
(
2
),
text
.
group
(
3
),
text
.
group
(
1
))
text
.
group
(
2
),
text
.
group
(
3
),
text
.
group
(
1
))
dep_file
.
add_relation
(
#
dep_file.add_relation(
DepRelation
(
"
%
s.
%
s"
%
(
text
.
group
(
2
),
text
.
group
(
3
)),
#
DepRelation("%s.%s" % (text.group(2), text.group(3)),
DepRelation
.
USE
,
#
DepRelation.USE,
DepRelation
.
ARCHITECTURE
))
#
DepRelation.ARCHITECTURE))
return
"<hdlmake instance_from_library
%
s|
%
s>"
%
(
text
.
group
(
1
),
return
"<hdlmake instance_from_library
%
s|
%
s>"
%
(
text
.
group
(
1
),
text
.
group
(
3
))
text
.
group
(
3
))
buf
=
re
.
sub
(
instance_from_library_pattern
,
buf
=
re
.
sub
(
instance_from_library_pattern
,
...
...
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