fparser.one.block_statements

Fortran block statements.

Module Contents

Classes

EndSource

Dummy End statement for BeginSource.

BeginSource

Fortran source content.

EndModule

END [<blocktype> [<name>]]

Module

MODULE <name>

EndPythonModule

END [<blocktype> [<name>]]

PythonModule

PYTHON MODULE <name>

EndProgram

END [PROGRAM [name]]

Program

PROGRAM [name]

EndBlockData

END [BLOCK DATA [<block-data-name>]]

BlockData

BLOCK DATA [<block-data-name>]

EndInterface

END [<blocktype> [<name>]]

Interface

INTERFACE [<generic-spec>] | ABSTRACT INTERFACE

EndSubroutine

END [SUBROUTINE [name]]

Subroutine

[<prefix>] SUBROUTINE <name> [( [<dummy-arg-list>] )

EndFunction

END [FUNCTION [name]]

Function

EndSelect

END [<blocktype> [<name>]]

SelectCase

[<case-construct-name> :] SELECT CASE ( <case-expr> )

SelectType

[<case-construct-name> :] SELECT TYPE ( <case-expr> )

EndWhere

END WHERE [<where-construct-name>]

EndForall

END FORALL [<forall-construct-name>]

EndIfThen

END IF [<if-construct-name>]

IfThen

[<if-construct-name> :] IF ( <scalar-logical-expr> ) THEN

If

IF ( <scalar-logical-expr> ) action-stmt

EndDo

END DO [<do-construct-name>]

Do

[<do-construct-name> :] DO label [loopcontrol]

EndAssociate

END ASSOCIATE [<associate-construct-name>]

Associate

[<associate-construct-name> :] ASSOCIATE ( <association-list> )

EndType

END TYPE [<type-name>]

EndEnum

END ENUM

Enum

ENUM , BIND(C)

Attributes

WhereConstruct

ForallConstruct

TypeDecl

class fparser.one.block_statements.EndSource(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

Dummy End statement for BeginSource.

match[source]
class fparser.one.block_statements.BeginSource(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement

Fortran source content.

match[source]
end_stmt_cls[source]
a[source]
tofortran(isfix=None)[source]
tostr()[source]
process_item()[source]

Process the line

analyze()[source]
get_classes()[source]
process_subitem(item)[source]

Check if item is blocks start statement, if it is, read the block.

Return True to stop adding items to given block.

topyf(tab='')[source]
class fparser.one.block_statements.EndModule(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [<blocktype> [<name>]]

EndStatement instances have additional attributes:

name
blocktype
match[source]
class fparser.one.block_statements.Module(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement, HasAttributes, HasImplicitStmt, HasUseStmt, HasVariables, HasTypeDecls, AccessSpecs

MODULE <name>

END [MODULE [name]]

match[source]
end_stmt_cls[source]
a[source]
known_attributes = ['PUBLIC', 'PRIVATE'][source]
get_classes()[source]
process_item()[source]

Process the line

get_provides()[source]

Returns dictonary containing statements that block provides or None when N/A.

get_interface()[source]
analyze()[source]
topyf(tab='')[source]

Constructs a pyf representation of this class.

Parameters:

tab (str) – White space to prepend to output.

Returns:

pyf code for this implicit statement.

Return type:

str

check_private(name)[source]
class fparser.one.block_statements.EndPythonModule(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [<blocktype> [<name>]]

EndStatement instances have additional attributes:

name
blocktype
match[source]
class fparser.one.block_statements.PythonModule(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement, HasImplicitStmt, HasUseStmt, HasVariables

PYTHON MODULE <name>

END [PYTHON MODULE [name]]

modes = ['pyf'][source]
match[source]
end_stmt_cls[source]
get_classes()[source]
process_item()[source]

Process the line

class fparser.one.block_statements.EndProgram(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [PROGRAM [name]]

match[source]
class fparser.one.block_statements.Program(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement, fparser.common.base_classes.ProgramBlock, HasVariables, HasImplicitStmt, HasUseStmt, AccessSpecs

PROGRAM [name]

match[source]
end_stmt_cls[source]
get_classes()[source]
process_item()[source]

Process the line

class fparser.one.block_statements.EndBlockData(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [BLOCK DATA [<block-data-name>]]

match[source]
blocktype = 'blockdata'[source]
class fparser.one.block_statements.BlockData(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement, HasImplicitStmt, HasUseStmt, HasVariables, AccessSpecs

BLOCK DATA [<block-data-name>]

end_stmt_cls[source]
match[source]
process_item()[source]

Process the line

get_classes()[source]
class fparser.one.block_statements.EndInterface(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [<blocktype> [<name>]]

EndStatement instances have additional attributes:

name
blocktype
match[source]
blocktype = 'interface'[source]
class fparser.one.block_statements.Interface(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement, HasAttributes, HasImplicitStmt, HasUseStmt, HasModuleProcedures, AccessSpecs

INTERFACE [<generic-spec>] | ABSTRACT INTERFACE END INTERFACE [<generic-spec>]

<generic-spec> = <generic-name>
OPERATOR ( <defined-operator> )
ASSIGNMENT ( = )
<dtio-generic-spec>
<dtio-generic-spec> = READ ( FORMATTED )
READ ( UNFORMATTED )
WRITE ( FORMATTED )
WRITE ( UNFORMATTED )
modes = ['free', 'fix', 'pyf'][source]
pattern = '(interface\\s*(\\w+\\s*\\(.*\\)|\\w*)|abstract\\s*interface)\\Z'[source]
match[source]
end_stmt_cls[source]
blocktype = 'interface'[source]
a[source]
get_classes()[source]
process_item()[source]

Process the line

tostr()[source]
analyze()[source]
topyf(tab='')[source]

Constructs a pyf representation of this class.

Parameters:

tab (str) – White space to prepend to output.

Returns:

pyf code for this implicit statement.

Return type:

str

class fparser.one.block_statements.EndSubroutine(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [SUBROUTINE [name]]

match[source]
class fparser.one.block_statements.Subroutine(parent, item=None)[source]

Bases: SubProgramStatement

[<prefix>] SUBROUTINE <name> [( [<dummy-arg-list>] ) [<proc-language-binding-spec>]]

end_stmt_cls[source]
pattern = '(recursive|pure|elemental|\\s)*subroutine\\s*\\w+'[source]
match[source]
_repr_attr_names[source]
class fparser.one.block_statements.EndFunction(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [FUNCTION [name]]

match[source]
class fparser.one.block_statements.Function(parent, item=None)[source]

Bases: SubProgramStatement

[<prefix>] FUNCTION <name> ( [<dummy-arg-list>] ) [<suffix>]
<prefix> = <prefix-spec> [<prefix-spec>]...
<prefix-spec> = <declaration-type-spec>
              | RECURSIVE | PURE | ELEMENTAL
<suffix> = <proc-language-binding-spec> [RESULT ( <result-name> )]
         | RESULT ( <result-name> ) [<proc-language-binding-spec>]
end_stmt_cls[source]
pattern = '(recursive|pure|elemental|\\s)*function\\s*\\w+'[source]
match[source]
_repr_attr_names[source]
subroutine_wrapper_code()[source]
subroutine_wrapper()[source]
class fparser.one.block_statements.EndSelect(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END [<blocktype> [<name>]]

EndStatement instances have additional attributes:

name
blocktype
match[source]
blocktype = 'select'[source]
class fparser.one.block_statements.SelectCase(parent, item=None)[source]

Bases: Select

[<case-construct-name> :] SELECT CASE ( <case-expr> )

match[source]
tostr()[source]
get_classes()[source]

Return the list of classes that this instance may have as children

class fparser.one.block_statements.SelectType(parent, item=None)[source]

Bases: Select

[<case-construct-name> :] SELECT TYPE ( <case-expr> )

match[source]
tostr()[source]
get_classes()[source]

Return the list of classes that this instance may have as children

class fparser.one.block_statements.EndWhere(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END WHERE [<where-construct-name>]

match[source]
fparser.one.block_statements.WhereConstruct[source]
class fparser.one.block_statements.EndForall(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END FORALL [<forall-construct-name>]

match[source]
fparser.one.block_statements.ForallConstruct[source]
class fparser.one.block_statements.EndIfThen(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END IF [<if-construct-name>]

match[source]
blocktype = 'if'[source]
class fparser.one.block_statements.IfThen(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement

[<if-construct-name> :] IF ( <scalar-logical-expr> ) THEN

IfThen instance has the following attributes:

expr

match[source]
end_stmt_cls[source]
name = ''[source]
tostr()[source]
process_item()[source]

Process the line

get_classes()[source]
class fparser.one.block_statements.If(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement

IF ( <scalar-logical-expr> ) action-stmt

match[source]
process_item()[source]

Process the line

tostr()[source]
tofortran(isfix=None)[source]
get_classes()[source]
class fparser.one.block_statements.EndDo(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END DO [<do-construct-name>]

match[source]
blocktype = 'do'[source]
process_item()[source]

Parses the next line assuming it is an “End do” statement.

Overrides method in EndStatement.

class fparser.one.block_statements.Do(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement

[<do-construct-name> :] DO label [loopcontrol] [<do-construct-name> :] DO [loopcontrol]

match[source]
pattern = 'do\\b\\s*(?:(?P<label>\\d+)\\s*)?(?:,\\s*)?(?P<loopcontrol>.+)?\\Z'[source]
item_re[source]
end_stmt_cls[source]
name = ''[source]
tostr()[source]
process_item()[source]

Parses the next line assuming it is a “Do” statement.

Overrides method in BeginStatement.

process_subitem(item)[source]

Check if item is blocks start statement, if it is, read the block.

Return True to stop adding items to given block.

get_classes()[source]
class fparser.one.block_statements.EndAssociate(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END ASSOCIATE [<associate-construct-name>]

match[source]
class fparser.one.block_statements.Associate(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement

[<associate-construct-name> :] ASSOCIATE ( <association-list> )

<block>

<association> = <associate-name> => <selector> <selector> = <expr> | <variable>

match[source]
end_stmt_cls[source]
process_item()[source]

Process the line

tostr()[source]
get_classes()[source]
class fparser.one.block_statements.EndType(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END TYPE [<type-name>]

match[source]
blocktype = 'type'[source]
fparser.one.block_statements.TypeDecl[source]
class fparser.one.block_statements.EndEnum(parent, item)[source]

Bases: fparser.common.base_classes.EndStatement

END ENUM

match[source]
blocktype = 'enum'[source]
class fparser.one.block_statements.Enum(parent, item=None)[source]

Bases: fparser.common.base_classes.BeginStatement

ENUM , BIND(C)

<enumerator-def-stmt> [<enumerator-def-stmt>]…

blocktype = 'enum'[source]
end_stmt_cls[source]
match[source]
process_item()[source]

Process the line

get_classes()[source]