blark.transform.GlobalVariableDeclaration

class blark.transform.GlobalVariableDeclaration(spec: GlobalVariableSpec, init: TypeInitialization | SubrangeTypeInitialization | EnumeratedTypeInitialization | ArrayTypeInitialization | InitializedStructure | StringTypeInitialization | FunctionCall, meta: Meta | None = None)[source]

Bases: object

A declaration of one or more global variables: name and location specification and initialization type.

Examples:

fValue1 : INT;
fValue2 : INT (0..10);
fValue3 : (A, B);
fValue4 : (A, B) DINT;
fValue5 : ARRAY [1..10] OF INT;
fValue6 : ARRAY [1..10] OF ARRAY [1..10] OF INT;
fValue7 : FB_Test(1, 2, 3);
fValue8 : FB_Test(A := 1, B := 2, C => 3);
fValue9 : STRING[10] := 'abc';

Lark grammar

This class is used by the following grammar rules:

global_var_decl

global_var_decl: global_var_spec ":" ( _located_var_spec_init | function_call ) ";"+

Methods

__init__(spec, init[, meta])

from_lark()

Attributes

base_type_name

The base type name of the variable(s).

full_type_name

The full type name of the variable(s).

location

The (optional) variable location.

meta

variables

The variable names contained.

spec

init

spec: GlobalVariableSpec
init: TypeInitialization | SubrangeTypeInitialization | EnumeratedTypeInitialization | ArrayTypeInitialization | InitializedStructure | StringTypeInitialization | FunctionCall
meta: Meta | None = None
property variables: List[Token]

The variable names contained.

property location: IncompleteLocation | Location | None

The (optional) variable location.

property base_type_name: str | Token

The base type name of the variable(s).

property full_type_name: str | Token

The full type name of the variable(s).

__init__(spec: GlobalVariableSpec, init: TypeInitialization | SubrangeTypeInitialization | EnumeratedTypeInitialization | ArrayTypeInitialization | InitializedStructure | StringTypeInitialization | FunctionCall, meta: Meta | None = None) None
from_lark() T