aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/dom
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2022-12-25 13:42:40 +0100
committerPatrick Lehmann <Patrick.Lehmann@plc2.de>2022-12-25 13:42:40 +0100
commitf276ac42e251190c4f6cb2bbc4b488923f328551 (patch)
tree20634fbf4f30ad00718b0491f784cc2eaf24b168 /pyGHDL/dom
parenta1b9335c08140fc9fc5d02591f3cb2870c5ba988 (diff)
downloadghdl-f276ac42e251190c4f6cb2bbc4b488923f328551.tar.gz
ghdl-f276ac42e251190c4f6cb2bbc4b488923f328551.tar.bz2
ghdl-f276ac42e251190c4f6cb2bbc4b488923f328551.zip
Updated pretty printing.
Diffstat (limited to 'pyGHDL/dom')
-rw-r--r--pyGHDL/dom/formatting/prettyprint.py45
1 files changed, 23 insertions, 22 deletions
diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py
index 0f548210b..26a964aec 100644
--- a/pyGHDL/dom/formatting/prettyprint.py
+++ b/pyGHDL/dom/formatting/prettyprint.py
@@ -133,37 +133,33 @@ class PrettyPrint:
def formatLibrary(self, library: Library, level: int = 0) -> StringBuffer:
buffer = []
prefix = " " * level
- buffer.append(f"{prefix}Entities:")
- for entity in library.Entities:
- buffer.append(f"{prefix} - {entity.Identifier}({', '.join([a.Identifier for a in entity.Architectures])})")
+ buffer.append(f"{prefix}Contexts:")
+ for context in library.Contexts.values():
+ buffer.append(f"{prefix} - {context.Identifier}")
buffer.append(f"{prefix}Packages:")
- for package in library.Packages:
+ for package in library.Packages.values():
if isinstance(package, Package):
buffer.append(f"{prefix} - {package.Identifier}")
elif isinstance(package, PackageInstantiation):
buffer.append(f"{prefix} - {package.Identifier} instantiate from {package.PackageReference}")
+ buffer.append(f"{prefix}Entities:")
+ for entity in library.Entities.values():
+ buffer.append(f"{prefix} - {entity.Identifier}({', '.join([a.Identifier for a in entity.Architectures])})")
buffer.append(f"{prefix}Configurations:")
- for configuration in library.Configurations:
+ for configuration in library.Configurations.values():
buffer.append(f"{prefix} - {configuration.Identifier}")
- buffer.append(f"{prefix}Contexts:")
- for context in library.Contexts:
- buffer.append(f"{prefix} - {context.Identifier}")
return buffer
def formatDocument(self, document: Document, level: int = 0) -> StringBuffer:
buffer = []
prefix = " " * level
- buffer.append(f"{prefix}Entities:")
- for entity in document.Entities:
- for line in self.formatEntity(entity, level + 1):
- buffer.append(line)
- buffer.append(f"{prefix}Architectures:")
- for architecture in document.Architectures:
- for line in self.formatArchitecture(architecture, level + 1):
+ buffer.append(f"{prefix}Contexts:")
+ for context in document.Contexts.values():
+ for line in self.formatContext(context, level + 1):
buffer.append(line)
buffer.append(f"{prefix}Packages:")
- for package in document.Packages:
+ for package in document.Packages.values():
if isinstance(package, Package):
gen = self.formatPackage
else:
@@ -172,17 +168,22 @@ class PrettyPrint:
for line in gen(package, level + 1):
buffer.append(line)
buffer.append(f"{prefix}PackageBodies:")
- for packageBodies in document.PackageBodies:
+ for packageBodies in document.PackageBodies.values():
for line in self.formatPackageBody(packageBodies, level + 1):
buffer.append(line)
+ buffer.append(f"{prefix}Entities:")
+ for entity in document.Entities.values():
+ for line in self.formatEntity(entity, level + 1):
+ buffer.append(line)
+ buffer.append(f"{prefix}Architectures:")
+ for architectures in document.Architectures.values():
+ for architecture in architectures.values():
+ for line in self.formatArchitecture(architecture, level + 1):
+ buffer.append(line)
buffer.append(f"{prefix}Configurations:")
- for configuration in document.Configurations:
+ for configuration in document.Configurations.values():
for line in self.formatConfiguration(configuration, level + 1):
buffer.append(line)
- buffer.append(f"{prefix}Contexts:")
- for context in document.Contexts:
- for line in self.formatContext(context, level + 1):
- buffer.append(line)
return buffer