F2x.parser.tree module

This module contains the base classes for the Abtract Generation Tree that is built by the parser form the Fortran sources.

class F2x.parser.tree.FuncDef(ast)

Bases: F2x.parser.tree.SubDef

class F2x.parser.tree.Module(ast)

Bases: F2x.parser.tree.Node

class F2x.parser.tree.Node(ast)

Bases: dict

Node constructor stores local AST node in _ast and calls _init_children() which should be overwritten by child classes.

This is the base class for the simplified AST that can easily be used in templates. It is simply a dict which stores child nodes as values. This allows to simply use node.child to access the values from a template. E.g. to get the modules name, you can simply use

{{ module.name }}

class F2x.parser.tree.SubDef(ast)

Bases: F2x.parser.tree.Node

class F2x.parser.tree.TypeDef(ast)

Bases: F2x.parser.tree.Node

class F2x.parser.tree.VarDecl(ast, prefix='')

Bases: F2x.parser.tree.Node

A variable declaration.

The following properties are available:

name

The symbolic name of the variable.

type

The C type of this variable. This might be a basic type (REAL, INTEGER, LOGICAL) or TYPE(C) for any other type like arrays, derived types or strings.

intent

May be 'IN', 'OUT', or 'INOUT'.

getter

This indicates whether the generated getter should be a FUNCTIN or SUBROUTINE’.

setter

(opt)

This indicates whether a SUBROUTINE should be generated as setter.

ftype

(opt)

The name of the derived type.

strlen

(opt)

The length of the string.

kind

(opt)

The KIND specifier if available.

dynamic

(opt)

Indicates whether the variable is ALLOCATABLE or a POINTER.

dims

(opt)

For an array contains a list with the sizes per dimension.

with_intent(intent)