blark.transform.FunctionBlock
- class blark.transform.FunctionBlock(name: Token, access: AccessSpecifier | None, extends: Extends | None, implements: Implements | None, declarations: List[VariableDeclarationBlock], body: StatementList | None, meta: Meta | None = None)[source]
Bases:
object
A full function block type declaration.
A function block distinguishes itself from a regular function by having state and potentially having actions, methods, and properties. These additional parts are separate in this grammar (i.e., they do not appear within the FUNCTION_BLOCK itself).
An implementation is optional, but
END_FUNCTION_BLOCK
is required.Examples:
FUNCTION_BLOCK FB_EmptyFunctionBlock END_FUNCTION_BLOCK FUNCTION_BLOCK FB_Implementer IMPLEMENTS I_fbName END_FUNCTION_BLOCK FUNCTION_BLOCK ABSTRACT FB_Extender EXTENDS OtherFbName END_FUNCTION_BLOCK FUNCTION_BLOCK FB_WithVariables VAR_INPUT bExecute : BOOL; END_VAR VAR_OUTPUT iResult : INT; END_VAR END_FUNCTION_BLOCK
Lark grammar
This class is used by the following grammar rules:
function_block_type_declaration
function_block_type_declaration: FUNCTION_BLOCK [ access_specifier ] derived_function_block_name [ extends ] [ implements ] fb_var_declaration* [ function_block_body ] END_FUNCTION_BLOCK ";"*
Methods
__init__
(name, access, extends, implements, ...)from_lark
(fb_token, access, derived_name, ...)Attributes
- access: AccessSpecifier | None
- implements: Implements | None
- declarations: List[VariableDeclarationBlock]
- body: StatementList | None
- static from_lark(fb_token: Token, access: AccessSpecifier | None, derived_name: Token, extends: Extends | None, implements: Implements | None, *args) FunctionBlock [source]
- __init__(name: Token, access: AccessSpecifier | None, extends: Extends | None, implements: Implements | None, declarations: List[VariableDeclarationBlock], body: StatementList | None, meta: Meta | None = None) None