pyGHDL.libghdl.utils
Generators and helpers on top of the raw libghdl bindings.
Iterating a chain, a list or an flist, and resolving the leftmost source location of a node, are needed everywhere and are ugly against the raw API, so they live here.
Functions
name_image(): Lookup aIdand return its string.fields_image(): String representation offieldsidx.kind_image(): String representation ofIir_Kindk.types_image(): String representation oftypest.attr_image(): String representation ofAttra.leftest_location(): Return the location of the leftmost token of a node.fields_iter(): Iterate on fields of noden.chain_iter(): Iterate of a chain headed by noden.chain_to_list(): Convert a chain headed by nodento a Python list.nodes_iter(): Iterate all nodes ofn, includingn.list_iter(): Iterate all elements of the Iir_Listlst.flist_iter(): Iterate all elements of the Iir_Flistlst.declarations_iter(): Iterate all declarations in noden.concurrent_stmts_iter(): Iterate concurrent statements in noden.constructs_iter(): Iterate library units, concurrent statements and declarationssequential_iter(): Iterate sequential statements. The first node must be either
Functions
- pyGHDL.libghdl.utils.leftest_location(n)[source]
Return the location of the leftmost token of a node.
A node’s own location is the token the parser considered characteristic, which for a subtype indication or a name is not the first one written. This walks left until there is nothing further.
- Parameters:
n – The IIR node to locate.
- Returns:
The location of the leftmost token, or
No_LocationifnisNull_Iir.
- pyGHDL.libghdl.utils.nodes_iter(n)[source]
Iterate all nodes of
n, includingn. Nodes are returned only once.