blark.transform.MultiElementVariable

class blark.transform.MultiElementVariable(name: SimpleVariable, dereferenced: bool, elements: List[SubscriptList | FieldSelector], meta: Meta | None = None)[source]

Bases: Variable

A multi-element variable - with one or more subscripts and fields.

Examples:

a.b.c
a^.b[1].c
a.b[SomeConstant].c^

Where a is the “name”

Lark grammar

This class is used by the following grammar rules:

multi_element_variable

multi_element_variable: variable_name ( subscript_list | field_selector )+

Methods

__init__(name, dereferenced, elements[, meta])

from_lark(variable_name, *subscript_or_field)

Attributes

meta

name

The first part of the variable name.

dereferenced

This is unused (TODO / perhaps for compat elsewhere?) Dereference status is held on a per-element basis.

elements

The subscripts/fields that make up the multi-element variable.

name: SimpleVariable

The first part of the variable name.

dereferenced: bool

This is unused (TODO / perhaps for compat elsewhere?) Dereference status is held on a per-element basis.

elements: List[SubscriptList | FieldSelector]

The subscripts/fields that make up the multi-element variable.

meta: Meta | None = None
static from_lark(variable_name: SimpleVariable, *subscript_or_field: SubscriptList | FieldSelector) MultiElementVariable[source]
__init__(name: SimpleVariable, dereferenced: bool, elements: List[SubscriptList | FieldSelector], meta: Meta | None = None) None