pyGHDL.dom.formatting.prettyprint
This module offers a formatter to render a design, document or design unit as an indented plain-text tree.
Exceptions
PrettyPrintException: The exception is raised when a model item cannot be rendered back to VHDL source code.
Classes
PrettyPrint: Renders apyGHDL.domdesign, document or design unit as an indented plain-text tree.
Exceptions
- exception pyGHDL.dom.formatting.prettyprint.PrettyPrintException(message='')[source]
The exception is raised when a model item cannot be rendered back to VHDL source code.
It reports an item the pretty-printer has no formatting rule for.
Inheritance
- Parameters:
message (str)
- Return type:
None
Classes
- class pyGHDL.dom.formatting.prettyprint.PrettyPrint[source]
Renders a
pyGHDL.domdesign, document or design unit as an indented plain-text tree.Each
Format*method returns a list of lines and is given an indentationlevel, so the methods compose from a whole design down to the smallest model item.Inheritance
- CleanupDocumentationBlocks(documentationContent, level=0)[source]
Renders a documentation comment as its first line, indented to the given level.
- formatEntity(entity, level=0)[source]
Renders an entity’s generics, ports, declarations and statements.
- formatArchitecture(architecture, level=0)[source]
Renders an architecture’s declarations and statements.
- Parameters:
architecture (
Architecture) – The architecture to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatPackageInstance(package, level=0)[source]
Renders a package instantiation’s generic map.
- Parameters:
package (
PackageInstantiation) – The package instantiation to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatPackageBody(packageBody, level=0)[source]
Renders a package body’s declarations.
- Parameters:
packageBody (
PackageBody) – The package body to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatConfiguration(configuration, level=0)[source]
Renders a configuration.
- Parameters:
configuration (
Configuration) – The configuration to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatGeneric(generic, level=0)[source]
Renders a generic, dispatching on its kind.
- Parameters:
generic (
NamedEntityMixin|GenericInterfaceItemMixin) – The generic interface item to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatPort(port, level=0)[source]
Renders a port, dispatching on its kind.
- Parameters:
port (
NamedEntityMixin|PortInterfaceItemMixin) – The port interface item to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatGenericConstant(generic, level=0)[source]
Renders a generic constant.
- Parameters:
generic (
GenericConstantInterfaceItem) – The generic constant to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatGenericType(generic, level=0)[source]
Renders a generic type.
- Parameters:
generic (
GenericConstantInterfaceItem) – The generic type to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatPortSignal(port, level=0)[source]
Renders a port signal.
- Parameters:
port (
PortSimpleSignalInterfaceItem) – The port signal to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatPortView(port, level=0)[source]
Renders a port declared with a mode view.
- Parameters:
port (
PortViewSignalInterfaceItem) – The port mode view to render.level (
int) – The indentation level, two spaces each.
- Return type:
- Returns:
The rendered lines.
- formatModeViewElement(element)[source]
Renders a mode view element.
- Parameters:
element (
ModeViewElement) – The mode view element to render.- Return type:
- Returns:
The rendered line.
- formatSubtypeIndication(subtypeIndication, entity, name)[source]
Renders a subtype indication.
- Parameters:
- Return type:
- Returns:
The rendered subtype indication.
- Raises:
PrettyPrintException – If the subtype indication’s kind is not handled.
- formatInitialValue(item)[source]
Renders an object’s default value, if it has one.
- Parameters:
item (
WithDefaultExpressionMixin) – The object to render.- Return type:
- Returns:
The rendered line.