blark.transform.ForStatement

class blark.transform.ForStatement(control: SimpleVariable | MultiElementVariable, from_: Expression, to: Expression, step: Expression | None, statements: StatementList, meta: Meta | None = None)[source]

Bases: Statement

A loop with a control variable and a start, stop, and (optional) step value.

Examples:

FOR iIndex := 0 TO 10
DO
    iValue := iIndex * 2;
END_FOR

FOR iIndex := (iValue - 5) TO (iValue + 5) BY 2
DO
    arrArray[iIndex] := iIndex * 2;
END_FOR

Lark grammar

This class is used by the following grammar rules:

for_statement

for_statement: "FOR"i control_variable ":=" _for_list "DO"i statement_list "END_FOR"i ";"*

Methods

__init__(control, from_, to, step, statements)

from_lark()

Attributes

meta

control

from_

to

step

statements

control: SimpleVariable | MultiElementVariable
from_: Expression
to: Expression
step: Expression | None
statements: StatementList
meta: Meta | None = None
__init__(control: SimpleVariable | MultiElementVariable, from_: Expression, to: Expression, step: Expression | None, statements: StatementList, meta: Meta | None = None) None
from_lark() T