pyGHDL.dom
Document object model (DOM) for pyGHDL.libghdl based on pyVHDLModel.
Submodules
- pyGHDL.dom.Aggregates
- pyGHDL.dom.Attribute
- pyGHDL.dom.Concurrent
- pyGHDL.dom.Configuration
- pyGHDL.dom.DesignUnit
- pyGHDL.dom.Expression
- pyGHDL.dom.InterfaceItem
- pyGHDL.dom.Literal
- pyGHDL.dom.Misc
- pyGHDL.dom.Name
- pyGHDL.dom.NonStandard
- pyGHDL.dom.Object
- pyGHDL.dom.PSL
- pyGHDL.dom.Range
- pyGHDL.dom.Sequential
- pyGHDL.dom.Subprogram
- pyGHDL.dom.Symbol
- pyGHDL.dom.Type
- pyGHDL.dom._Translate
- pyGHDL.dom._Utils
- pyGHDL.dom.formatting
Exceptions
DOMException: The exception is raised when an IIR node cannot be translated to a pyVHDLModel object.
Classes
Position: Represents the source code position of a IIR node in a source file.DOMMixin: Mixin adding the originating IIR node and its source code position to apyGHDL.domobject.
Exceptions
- exception pyGHDL.dom.DOMException(message='')[source]
The exception is raised when an IIR node cannot be translated to a pyVHDLModel object.
It reports a node kind the translation does not handle, or a node whose shape does not match what the surrounding construct expects. The message names the kind and, where available, the source position.
Inheritance
- Parameters:
message (str)
- Return type:
None
Classes
- class pyGHDL.dom.Position(filename, line, column)[source]
Represents the source code position of a IIR node in a source file.
Inheritance
- classmethod parse(node)[source]
Return the source code position of a IIR node.
- Parameters:
node (
TypeVar(Iir, bound=c_int)) – The IIR node to read the position of.- Return type:
- Returns:
The node’s position in its source file.
- Raises:
ValueError – If parameter
nodeisNull_Iir.
- property Filename: Path
Read-only property to access the filename this source code position refers to (
_filename).- Returns:
The source code position’s filename.
- property Line: int
Read-only property to access the line number this source code position refers to (
_line).- Returns:
The source code position’s line.
- property Column: int
Read-only property to access the column this source code position refers to (
_column).- Returns:
The source code position’s column.
- __str__()[source]
Formats the source code position as
<filename>:<line>:<column>.- Return type:
- Returns:
A string representation of this source code position.
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- class pyGHDL.dom.DOMMixin(node)[source]
Mixin adding the originating IIR node and its source code position to a
pyGHDL.domobject.Every class in
pyGHDL.domthat mirrors a pyVHDLModel class inherits this mixin, so a model object can always be traced back to the node in libghdl’s tree it was translated from.Inheritance
- Parameters:
node (Iir)
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- Parameters:
predicate (
TypeVar(TAttr) |Iterable[TypeVar(TAttr)] |None) – An attribute class, an iterable of attribute classes, orNoneto accept every attribute.- Return type:
- Returns:
Dictionary of methods and the matching attributes attached to them.
- Raises:
ValueError – If an element of parameter ‘predicate’ is not a sub-class of
Attribute.ValueError – If parameter ‘predicate’ is neither an attribute class nor an iterable of those.
- __init__(node)[source]
Initializes the mixin with the IIR node a DOM object was translated from.
The source code position is not resolved here, but on first access of
Position.
- _position: <pyTooling.Decorators.readonly object at 0x7f3f462456d0>
The IIR node’s position in the source file, resolved on first access and then cached.