Group#
Groups can be declared using the group declaration.
Groups are used either as a list of group items or as adaptation of an expression may for groups.
Group class diagram#
Group construction#
Group constructor is : ( group ). A group is itself a list of group items.
- class ansys.scadeone.core.swan.GroupConstructor(group: Group)#
Bases:
Expression
A group expression: group_expr ::= (*group).
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- class ansys.scadeone.core.swan.Group(items: List[GroupItem])#
Bases:
SwanItem
Group item as a list of GroupItem.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- class ansys.scadeone.core.swan.GroupItem(expr: Expression, label: Identifier | None = None)#
Bases:
SwanItem
Item of a group expression: group_item ::= [[ label : ]] expr.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property expr: Expression#
Expression.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property label: Identifier | None#
Group item label.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
Group projection and renaming#
A group projection accesses to fields in a group and returns a group of the matching fields, using renaming.
The syntax is: expr .( group_renaming ) where .( group_renaming )
is a group adaptation, also used for Connection
in diagrams.
- class ansys.scadeone.core.swan.GroupProjection(expr: Expression, adaptation: GroupAdaptation)#
Bases:
Expression
Group projection: group_expr ::= expr group_adaptation.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property adaptation: GroupAdaptation#
Expression group adaptation.
- property expr: Expression#
Adapted expression.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- class ansys.scadeone.core.swan.GroupAdaptation(renamings: List[GroupRenaming])#
Bases:
SwanItem
Group adaptation: group_adaptation ::= . ( group_renamings ).
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property renamings: List[GroupRenaming]#
Renaming list of group adaptation.
- class ansys.scadeone.core.swan.GroupRenaming(source: Identifier | Literal, renaming: Identifier | None = None, is_shortcut: bool | None = False)#
Bases:
SwanItem
Group renaming: (( Id | Integer)) [: [Id]].
Renaming source index as Id or Integer, either a name or a position. For example: a or 2.
Optional renaming target index:
No index
Renaming as : Id, for example: a : b, 2 : b
Shortcut, example a : means a : a
- Parameters:
- source: common.Identifier | LiteralExpr
Source index.
- renaming: common.Identifier (optional)
Renaming as an Identifier.
- is_shortcut: bool (optional)
Renaming is a shortcut of the form ID.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property is_valid: bool#
True when renaming is a shortcut with no renaming, or a renaming with no shortcut.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property renaming: Identifier | None#
Renaming in new group. None if no renaming.
- property source: Identifier | Literal#
Source selection in group.
- class ansys.scadeone.core.swan.ProtectedGroupRenaming(data: str, markup: str | None = 'syntax')#
Bases:
GroupRenaming
,ProtectedItem
Specific class when a renaming is protected for syntax error.
Source is an adaptation such as: .( {syntax%renaming%syntax} ).
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property is_protected#
Tell if item is syntactically protected and provided as a string.
- property is_valid: bool#
True when renaming is a shortcut with no renaming, or a renaming with no shortcut.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
- property renaming: Identifier | None#
Renaming in new group. None if no renaming.