aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/dom/formatting
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-07-30 09:00:16 +0200
committerumarcor <unai.martinezcorral@ehu.eus>2021-08-23 16:35:33 +0200
commitee6a244880f2d4fff429118ccbce043b342fae4d (patch)
tree2c7db978fe217bab10c9d238a72c59142f3ad2c1 /pyGHDL/dom/formatting
parent31eb230938730059254bc4778bf1eff14015221f (diff)
downloadghdl-ee6a244880f2d4fff429118ccbce043b342fae4d.tar.gz
ghdl-ee6a244880f2d4fff429118ccbce043b342fae4d.tar.bz2
ghdl-ee6a244880f2d4fff429118ccbce043b342fae4d.zip
PrettyPrint deferred constants.
Diffstat (limited to 'pyGHDL/dom/formatting')
-rw-r--r--pyGHDL/dom/formatting/prettyprint.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py
index 20355db24..8ab854212 100644
--- a/pyGHDL/dom/formatting/prettyprint.py
+++ b/pyGHDL/dom/formatting/prettyprint.py
@@ -41,7 +41,7 @@ from pyVHDLModel.SyntaxModel import (
WithDefaultExpressionMixin,
Function,
BaseType,
- FullType,
+ FullType, BaseConstant,
)
from pyGHDL import GHDLBaseException
@@ -79,7 +79,7 @@ from pyGHDL.dom.InterfaceItem import (
PortSignalInterfaceItem,
GenericTypeInterfaceItem,
)
-from pyGHDL.dom.Object import Constant, Signal, SharedVariable, File
+from pyGHDL.dom.Object import Constant, Signal, SharedVariable, File, DeferredConstant
from pyGHDL.dom.Attribute import Attribute, AttributeSpecification
from pyGHDL.dom.Subprogram import Procedure
from pyGHDL.dom.Misc import Alias
@@ -415,15 +415,20 @@ class PrettyPrint:
buffer = []
prefix = " " * level
- if isinstance(item, Constant):
+ if isinstance(item, BaseConstant):
+ if isinstance(item, Constant):
+ default = " := {expr}".format(expr=str(item.DefaultExpression))
+ else:
+ default = ""
+
buffer.append(
- "{prefix}- constant {name} : {subtype} := {expr}".format(
+ "{prefix}- constant {name} : {subtype}{default}".format(
prefix=prefix,
name=", ".join(item.Identifiers),
subtype=self.formatSubtypeIndication(
item.Subtype, "constant", item.Identifiers[0]
),
- expr=str(item.DefaultExpression),
+ default=default,
)
)
elif isinstance(item, SharedVariable):