blark.transform.Function

class blark.transform.Function(access: AccessSpecifier | None, name: Token, return_type: SimpleSpecification | IndirectSimpleSpecification | None, declarations: List[VariableDeclarationBlock], body: StatementList | None, meta: Meta | None = None)[source]

Bases: object

A full function block type declaration, with nested variable declaration blocks.

An implementation is optional, but END_FUNCTION is required.

Examples:

FUNCTION FuncName : INT
    VAR_INPUT
        iValue : INT := 0;
    END_VAR
    FuncName := iValue;
END_FUNCTION

Lark grammar

This class is used by the following grammar rules:

function_declaration

function_declaration: "FUNCTION"i [ access_specifier ] derived_function_name [ ":" indirect_simple_specification ] ";"* [ function_var_block+ ] [ function_body ] "END_FUNCTION"i ";"*

Methods

__init__(access, name, return_type, ...[, meta])

from_lark(access, name, return_type, *remainder)

Attributes

meta

access

name

return_type

declarations

body

access: AccessSpecifier | None
name: Token
return_type: SimpleSpecification | IndirectSimpleSpecification | None
declarations: List[VariableDeclarationBlock]
body: StatementList | None
meta: Meta | None = None
static from_lark(access: AccessSpecifier | None, name: Token, return_type: SimpleSpecification | IndirectSimpleSpecification | None, *remainder) Function[source]
__init__(access: AccessSpecifier | None, name: Token, return_type: SimpleSpecification | IndirectSimpleSpecification | None, declarations: List[VariableDeclarationBlock], body: StatementList | None, meta: Meta | None = None) None