Selection#
These expressions represent if and case expressions.
Conditional expression#
- class ansys.scadeone.core.swan.IfteExpr(cond_expr: Expression, then_expr: Expression, else_expr: Expression)#
Bases:
Expression
Conditional if/then/else expression: if expr then expr else 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 cond_expr: Expression#
Condition expression.
- property else_expr: Expression#
Else 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.
- property then_expr: Expression#
Then expression.
Case expression#
- class ansys.scadeone.core.swan.CaseExpr(expr: Expression, branches: List[CaseBranch])#
Bases:
Expression
Case expression: case expr of {{ | pattern : 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 branches: List[CaseBranch]#
Case branches.
- property expr: Expression#
Case 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.CaseBranch(pattern: Pattern, expr: Expression)#
Bases:
SwanItem
Case branch expression: pattern : expr.
See
ansys.scadeone.swan.expressions.CaseExpr
.- 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#
Case branch 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.