psyclone.psyir.nodes.container

This module contains the Container node implementation.

Classes

  • Container: Node representing a set of Routine and/or Container nodes, as well

class psyclone.psyir.nodes.container.Container(name, **kwargs)

Node representing a set of Routine and/or Container nodes, as well as a name and a SymbolTable. This construct can be used to scope symbols of variables, Routine names and Container names. In Fortran a container would naturally represent a module or a submodule.

Parameters:

Inheritance

Inheritance diagram of Container
classmethod create(name, symbol_table, children)

Create a Container instance given a name, a symbol table and a list of child nodes.

Parameters:
Returns:

an instance of cls.

Return type:

psyclone.psyir.nodes.Container or subclass thereof

Raises:

GenerationError – if the arguments to the create method are not of the expected type.

get_routine_psyir(name)

Returns the PSyIR for the routine with the given name, or None if a routine with this name does not exist.

Parameters:

name (str) – name of the routine to find.

Returns:

the PSyIR Routine instance of the subroutine, or None if there is no routine with that name in this container.

Return type:

Union[None, psyclone.psyir.nodes.Routine]

property name
Returns:

name of the container.

Return type:

str

node_str(colour=True)

Returns the name of this node with appropriate control codes to generate coloured output in a terminal that supports it.

Parameters:

colour (bool) – whether or not to include colour control codes.

Returns:

description of this node, possibly coloured.

Return type:

str