aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-02-08 03:54:12 +0100
committerTristan Gingold <tgingold@free.fr>2018-02-08 03:54:12 +0100
commit6e2719c66ce430ed1d9ec24273a2f54035f93d87 (patch)
treeab8836ef66a4352cb136c5a1759dcd50cc5865a8 /src
parent8cad35a2b34b2ed75a0d9b8979f23f507baeb3b2 (diff)
downloadghdl-6e2719c66ce430ed1d9ec24273a2f54035f93d87.tar.gz
ghdl-6e2719c66ce430ed1d9ec24273a2f54035f93d87.tar.bz2
ghdl-6e2719c66ce430ed1d9ec24273a2f54035f93d87.zip
Improve python binding.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/python/libghdl/thin.py1
-rw-r--r--src/vhdl/python/libghdl/thinutils.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/src/vhdl/python/libghdl/thin.py b/src/vhdl/python/libghdl/thin.py
index d16475cc6..b8ebc7355 100644
--- a/src/vhdl/python/libghdl/thin.py
+++ b/src/vhdl/python/libghdl/thin.py
@@ -108,6 +108,7 @@ _Get_Identifier_With_Len = libghdl.name_table__get_identifier_with_len
def Get_Identifier(s):
return _Get_Identifier_With_Len(c_char_p(s), len(s))
+Null_Identifier = 0
# Ieee
diff --git a/src/vhdl/python/libghdl/thinutils.py b/src/vhdl/python/libghdl/thinutils.py
index 93f00b8ba..85edafbff 100644
--- a/src/vhdl/python/libghdl/thinutils.py
+++ b/src/vhdl/python/libghdl/thinutils.py
@@ -194,6 +194,7 @@ def declarations_iter(n):
if n1 != Null_Iir:
for n2 in declarations_iter(n1):
yield n2
+ # All these nodes are handled:
if k in [iirs.Iir_Kind.Entity_Declaration,
iirs.Iir_Kind.Architecture_Body,
iirs.Iir_Kind.Package_Declaration,
@@ -248,7 +249,11 @@ def declarations_iter(n):
def concurrent_stmts_iter(n):
"""Iterator on concurrent statements in n."""
k = iirs.Get_Kind(n)
- if k == iirs.Iir_Kind.Design_Unit:
+ if k == iirs.Iir_Kind.Design_File:
+ for n1 in chain_iter(iirs.Get_First_Design_Unit(n)):
+ for n2 in concurrent_stmts_iter(n1):
+ yield n2
+ elif k == iirs.Iir_Kind.Design_Unit:
for n1 in concurrent_stmts_iter(iirs.Get_Library_Unit(n)):
yield n1
elif k == iirs.Iir_Kind.Entity_Declaration \