fparser.one.block_statements ============================ .. py:module:: fparser.one.block_statements .. autoapi-nested-parse:: Fortran block statements. Attributes ---------- .. autoapisummary:: fparser.one.block_statements.WhereConstruct fparser.one.block_statements.ForallConstruct fparser.one.block_statements.TypeDecl Classes ------- .. autoapisummary:: fparser.one.block_statements.EndSource fparser.one.block_statements.BeginSource fparser.one.block_statements.EndModule fparser.one.block_statements.Module fparser.one.block_statements.EndPythonModule fparser.one.block_statements.PythonModule fparser.one.block_statements.EndProgram fparser.one.block_statements.Program fparser.one.block_statements.EndBlockData fparser.one.block_statements.BlockData fparser.one.block_statements.EndInterface fparser.one.block_statements.Interface fparser.one.block_statements.EndSubroutine fparser.one.block_statements.Subroutine fparser.one.block_statements.EndFunction fparser.one.block_statements.Function fparser.one.block_statements.EndSelect fparser.one.block_statements.SelectCase fparser.one.block_statements.SelectType fparser.one.block_statements.EndWhere fparser.one.block_statements.EndForall fparser.one.block_statements.EndIfThen fparser.one.block_statements.IfThen fparser.one.block_statements.If fparser.one.block_statements.EndDo fparser.one.block_statements.Do fparser.one.block_statements.EndAssociate fparser.one.block_statements.Associate fparser.one.block_statements.EndType fparser.one.block_statements.EndEnum fparser.one.block_statements.Enum Module Contents --------------- .. py:class:: EndSource(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` Dummy End statement for BeginSource. .. py:attribute:: match .. py:class:: BeginSource(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement` Fortran source content. .. py:attribute:: match .. py:attribute:: end_stmt_cls .. py:attribute:: a .. py:method:: tofortran(isfix=None) .. py:method:: tostr() .. py:method:: process_item() Process the line .. py:method:: analyze() .. py:method:: get_classes() .. py:method:: process_subitem(item) Check if item is blocks start statement, if it is, read the block. Return True to stop adding items to given block. .. py:method:: topyf(tab='') .. py:class:: EndModule(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [ []] EndStatement instances have additional attributes:: name blocktype .. py:attribute:: match .. py:class:: Module(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement`, :py:obj:`HasAttributes`, :py:obj:`HasImplicitStmt`, :py:obj:`HasUseStmt`, :py:obj:`HasVariables`, :py:obj:`HasTypeDecls`, :py:obj:`AccessSpecs` MODULE .. END [MODULE [name]] .. py:attribute:: match .. py:attribute:: end_stmt_cls .. py:attribute:: a .. py:attribute:: known_attributes :value: ['PUBLIC', 'PRIVATE'] .. py:method:: get_classes() .. py:method:: process_item() Process the line .. py:method:: get_provides() Returns dictonary containing statements that block provides or None when N/A. .. py:method:: get_interface() .. py:method:: analyze() .. py:method:: topyf(tab='') Constructs a pyf representation of this class. :param str tab: White space to prepend to output. :returns: pyf code for this implicit statement. :rtype: str .. py:method:: check_private(name) .. py:class:: EndPythonModule(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [ []] EndStatement instances have additional attributes:: name blocktype .. py:attribute:: match .. py:class:: PythonModule(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement`, :py:obj:`HasImplicitStmt`, :py:obj:`HasUseStmt`, :py:obj:`HasVariables` PYTHON MODULE .. END [PYTHON MODULE [name]] .. py:attribute:: modes :value: ['pyf'] .. py:attribute:: match .. py:attribute:: end_stmt_cls .. py:method:: get_classes() .. py:method:: process_item() Process the line .. py:class:: EndProgram(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [PROGRAM [name]] .. py:attribute:: match .. py:class:: Program(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement`, :py:obj:`fparser.common.base_classes.ProgramBlock`, :py:obj:`HasVariables`, :py:obj:`HasImplicitStmt`, :py:obj:`HasUseStmt`, :py:obj:`AccessSpecs` PROGRAM [name] .. py:attribute:: match .. py:attribute:: end_stmt_cls .. py:method:: get_classes() .. py:method:: process_item() Process the line .. py:class:: EndBlockData(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [BLOCK DATA []] .. py:attribute:: match .. py:attribute:: blocktype :value: 'blockdata' .. py:class:: BlockData(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement`, :py:obj:`HasImplicitStmt`, :py:obj:`HasUseStmt`, :py:obj:`HasVariables`, :py:obj:`AccessSpecs` BLOCK DATA [] .. py:attribute:: end_stmt_cls .. py:attribute:: match .. py:method:: process_item() Process the line .. py:method:: get_classes() .. py:class:: EndInterface(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [ []] EndStatement instances have additional attributes:: name blocktype .. py:attribute:: match .. py:attribute:: blocktype :value: 'interface' .. py:class:: Interface(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement`, :py:obj:`HasAttributes`, :py:obj:`HasImplicitStmt`, :py:obj:`HasUseStmt`, :py:obj:`HasModuleProcedures`, :py:obj:`AccessSpecs` INTERFACE [] | ABSTRACT INTERFACE END INTERFACE [] = | OPERATOR ( ) | ASSIGNMENT ( = ) | = READ ( FORMATTED ) | READ ( UNFORMATTED ) | WRITE ( FORMATTED ) | WRITE ( UNFORMATTED ) .. py:attribute:: modes :value: ['free', 'fix', 'pyf'] .. py:attribute:: pattern :value: '(interface\\s*(\\w+\\s*\\(.*\\)|\\w*)|abstract\\s*interface)\\Z' .. py:attribute:: match .. py:attribute:: end_stmt_cls .. py:attribute:: blocktype :value: 'interface' .. py:attribute:: a .. py:method:: get_classes() .. py:method:: process_item() Process the line .. py:method:: tostr() .. py:method:: analyze() .. py:method:: topyf(tab='') Constructs a pyf representation of this class. :param str tab: White space to prepend to output. :returns: pyf code for this implicit statement. :rtype: str .. py:class:: EndSubroutine(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [SUBROUTINE [name]] .. py:attribute:: match .. py:class:: Subroutine(parent, item=None) Bases: :py:obj:`SubProgramStatement` [] SUBROUTINE [( [] ) []] .. py:attribute:: end_stmt_cls .. py:attribute:: pattern :value: '(recursive|pure|elemental|\\s)*subroutine\\s*\\w+' .. py:attribute:: match .. py:attribute:: _repr_attr_names :value: ['prefix', 'bind', 'suffix', 'args'] .. py:class:: EndFunction(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [FUNCTION [name]] .. py:attribute:: match .. py:class:: Function(parent, item=None) Bases: :py:obj:`SubProgramStatement` :: [] FUNCTION ( [] ) [] = []... = | RECURSIVE | PURE | ELEMENTAL = [RESULT ( )] | RESULT ( ) [] .. py:attribute:: end_stmt_cls .. py:attribute:: pattern :value: '(recursive|pure|elemental|\\s)*function\\s*\\w+' .. py:attribute:: match .. py:attribute:: _repr_attr_names :value: ['prefix', 'bind', 'suffix', 'args', 'typedecl'] .. py:method:: subroutine_wrapper_code() .. py:method:: subroutine_wrapper() .. py:class:: EndSelect(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END [ []] EndStatement instances have additional attributes:: name blocktype .. py:attribute:: match .. py:attribute:: blocktype :value: 'select' .. py:class:: SelectCase(parent, item=None) Bases: :py:obj:`Select` [ :] SELECT CASE ( ) .. py:attribute:: match .. py:method:: tostr() .. py:method:: get_classes() Return the list of classes that this instance may have as children .. py:class:: SelectType(parent, item=None) Bases: :py:obj:`Select` [ :] SELECT TYPE ( ) .. py:attribute:: match .. py:method:: tostr() .. py:method:: get_classes() Return the list of classes that this instance may have as children .. py:class:: EndWhere(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END WHERE [] .. py:attribute:: match .. py:data:: WhereConstruct .. py:class:: EndForall(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END FORALL [] .. py:attribute:: match .. py:data:: ForallConstruct .. py:class:: EndIfThen(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END IF [] .. py:attribute:: match .. py:attribute:: blocktype :value: 'if' .. py:class:: IfThen(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement` [ :] IF ( ) THEN IfThen instance has the following attributes: expr .. py:attribute:: match .. py:attribute:: end_stmt_cls .. py:attribute:: name :value: '' .. py:method:: tostr() .. py:method:: process_item() Process the line .. py:method:: get_classes() .. py:class:: If(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement` IF ( ) action-stmt .. py:attribute:: match .. py:method:: process_item() Process the line .. py:method:: tostr() .. py:method:: tofortran(isfix=None) .. py:method:: get_classes() .. py:class:: EndDo(parent, item) Bases: :py:obj:`fparser.common.base_classes.EndStatement` END DO [] .. py:attribute:: match .. py:attribute:: blocktype :value: 'do' .. py:method:: process_item() Parses the next line assuming it is an "End do" statement. Overrides method in `EndStatement`. .. py:class:: Do(parent, item=None) Bases: :py:obj:`fparser.common.base_classes.BeginStatement` [ :] DO label [loopcontrol] [ :] DO [loopcontrol] .. py:attribute:: match .. py:attribute:: pattern :value: 'do\\b\\s*(?:(?P