Group declaration#
A GroupDecl object defines a group declaration, with a name and
a GroupTypeExpression for the type.
A GroupTypeExpression can be:
a type expression, represented by a
TypeGroupTypeExpressioninstanceor a list of
GroupTypeExpressionitems, decomposed into two lists:a positional list of
GroupTypeExpressionitemsfollowed by a list of named
GroupTypeExpressionitems, represented withNamedGroupTypeExpressioninstances.
- class ansys.scadeone.core.swan.GroupDecl(id: Identifier, type: GroupTypeExpression, pragmas: List[Pragma] | None = None)#
Bases:
DeclarationGroup declaration with an id and a type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
Helper to set owner as the owner of each item in the Iterable items.
- property id: Identifier#
Language item identifier.
- 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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property type: GroupTypeExpression#
Group type expression.
- class ansys.scadeone.core.swan.GroupTypeExpression#
Bases:
SwanItemBase class for group type expressions.
- get_full_path() str#
Full path of the Swan construct.
This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.
- Returns:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf the method is not implemented for the current SwanItem type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- class ansys.scadeone.core.swan.TypeGroupTypeExpression(type: TypeExpression)#
Bases:
GroupTypeExpressionGroup type expression: group_type_expr ::= type_expr.
- get_full_path() str#
Full path of the Swan construct.
This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.
- Returns:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf the method is not implemented for the current SwanItem type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property type: TypeExpression#
Type expression of group item
- class ansys.scadeone.core.swan.NamedGroupTypeExpression(label: Identifier, type: GroupTypeExpression)#
Bases:
GroupTypeExpressionA named group type expression, used in GroupTypeExpressionList as id : group_type_expr.
- get_full_path() str#
Full path of the Swan construct.
This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.
- Returns:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf the method is not implemented for the current SwanItem type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
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 label: Identifier#
Label of named group item.
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property type: GroupTypeExpression#
Type of named group item.
- class ansys.scadeone.core.swan.GroupTypeExpressionList(positional: List[GroupTypeExpression], named: List[NamedGroupTypeExpression])#
Bases:
GroupTypeExpressionGroup list made of positional items followed by named items. Each item is a group type expression.
group_type_expr ::= ( group_type_expr {{ , group_type_expr }}{{ , id : group_type_expr }} )| ( id : group_type_expr {{ , id : group_type_expr }} )- get_full_path() str#
Full path of the Swan construct.
This method is implemented by derived classes that correspond to a declaration at the module level (such as sensor, type, group, const, operator), or a module itself.
- Returns:
strPath within the owner and name of the Swan construct.
- Raises:
ScadeOneExceptionIf the method is not implemented for the current SwanItem type.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
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 items: List[GroupTypeExpression]#
Returns all items
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.
- property named: List[NamedGroupTypeExpression]#
Return named group items
- property positional: List[GroupTypeExpression]#
Return positional group items
- class ansys.scadeone.core.swan.GroupDeclarations(groups: List[GroupDecl])#
Bases:
GlobalDeclarationGroup declarations: group {{ group_decl ; }}.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
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 model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.