loki.module
Contains the declaration of Module to represent Fortran modules.
Classes
|
Class to handle and manipulate source modules. |
- class Module(name=None, docstring=None, spec=None, contains=None, default_access_spec=None, public_access_spec=None, private_access_spec=None, ast=None, source=None, parent=None, symbol_attrs=None, rescope_symbols=False, incomplete=False, parser_classes=None)
Bases:
ProgramUnitClass to handle and manipulate source modules.
- Parameters:
name (str) – Name of the module.
docstring (
CommentBlockor list ofComment) – The module docstringspec (
Section, optional) – The spec section of the module.contains (tuple of
Subroutine, optional) – The module-subprogram part following aCONTAINSstatement declaring member procedures.default_access_spec (str, optional) – The default access attribute for variables as defined by an access-spec statement without access-id-list, i.e.,
publicorprivate. Default value is None corresponding to the absence of an access-spec statement for default accessibility (which is equivalent topublic).public_access_spec (tuple of str, optional) – List of identifiers that are declared
publicin an access-spec statement. Default value is None which is stored as an empty tuple.private_access_spec (tuple of str, optional) – List of identifiers that are declared
privatein an access-spec statement. Default value is None which is stored as an empty tuple.ast (optional) – The node for this module from the parse tree produced by the frontend.
source (
Source, optional) – Object representing the raw source string information from the read file.parent (
Scope, optional) – The enclosing parent scope of the module. Declarations from the parent scope remain valid within the module’s scope (unless shadowed by local declarations).rescope_symbols (bool, optional) – Ensure that the type information for all
TypedSymbolin the module’s IR exist in the module’s scope. Defaults to False.symbol_attrs (
SymbolTable, optional) – Use the providedSymbolTableobject instead of creating a newincomplete (bool, optional) – Mark the object as incomplete, i.e. only partially parsed. This is typically the case when it was instantiated using the
Frontend.REGEXfrontend and a full parse using one of the other frontends is pending.parser_classes (
RegexParserClass, optional) – Provide the list of parser classes used during incomplete regex parsing
- classmethod from_omni(ast, raw_source, definitions=None, parent=None, type_map=None)
Create
ModulefromOMNIparse tree- Parameters:
ast – The OMNI parse tree
raw_source (str) – Fortran source string
definitions (list, optional) – List of external
Moduleto provide derived-type and procedure declarationsparent (
Scope, optional) – The enclosing parent scope of the moduletype_map (dict, optional) – A mapping from type hash identifiers to type definitions, as provided in OMNI’s
typeTableparse tree node
- classmethod from_ofp(ast, raw_source, definitions=None, pp_info=None, parent=None)
Create
ModulefromOFPparse tree- Parameters:
ast – The OFP parse tree
raw_source (str) – Fortran source string
definitions (list) – List of external
Moduleto provide derived-type and procedure declarationspp_info – Preprocessing info as obtained by
sanitize_inputparent (
Scope, optional) – The enclosing parent scope of the module.
- classmethod from_fparser(ast, raw_source, definitions=None, pp_info=None, parent=None)
Create
ModulefromFPparse tree- Parameters:
ast – The FParser parse tree
raw_source (str) – Fortran source string
definitions (list) – List of external
Moduleto provide derived-type and procedure declarationspp_info – Preprocessing info as obtained by
sanitize_inputparent (
Scope, optional) – The enclosing parent scope of the module.
- classmethod from_regex(raw_source, parser_classes=None, parent=None)
Create
Modulefrom source regex’ing
- register_in_parent_scope()
Insert the type information for this object in the parent’s symbol table
If
parentis None, this does nothing.
- clone(**kwargs)
Create a copy of the module with the option to override individual parameters.
- property module_type
Return the
ModuleTypeof this module
- property definitions
The list of IR nodes defined by this module
Returns
SubroutineandTypeDefnodes declared in this module