Forward expression#
A forward expression is stored as a Forward
class. The class hierarchy is given in the following pictures:
Forward class diagram#
Forward return#
- class ansys.scadeone.core.swan.Forward(state: ForwardState, dimensions: List[ForwardDim], body: ForwardBody, returns: List[ForwardReturnItem], luid: Luid | None = None)#
Bases:
Expression
Forward expression:
fwd_expr ::= forward [[ luid]] [[ (( restart | resume )) ]] {{ dim }}+fwd_body returns ( returns_group )returns_group ::= [[ returns_item {{ , returns_item }} ]]- 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.ForwardBody(body: List[ScopeSection], unless_expr: Expression | None = None, until_expr: Expression | None = None)#
Bases:
SwanItem
forward construct:
fwd_body ::= [[ unless expr ]] scope_sections [[ until 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 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.
Dimensions#
- class ansys.scadeone.core.swan.ForwardDim(expr: Expression | None = None, dim_id: Identifier | None = None, elems: List[ForwardElement] | None = None, protected: str | None = None)#
Bases:
SwanItem
forward construct dimension:
dim ::= << expr >> [[ with (( << id >> | current_elt )) {{ current_elt }} ]]
Note that:
there may be no with part,
or it is an ID followed by a possible empty list,
or if no ID, at least one current_element.
The is_valid() method checks for that property.
- Parameters:
- expr: common.Expression
Dimension expression.
- id: common.Identifier (optional)
with ID.
- elems: List[ForwardElement] (optional)
with elements part.
- protected: str (optional)
Content of the dimension if it syntactically incorrect. In that case, all other parameters are None.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property dim_id: Identifier | None#
forward dimension ID, or None.
- property elems: List[ForwardElement] | None#
forward dimension elements or None.
- property expr: Expression#
forward dimension expression.
- property is_protected#
True when dimension is syntactically incorrect and protected.
- 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.ForwardElement(lhs: ForwardLHS, expr: Expression)#
Bases:
SwanItem
Forward current element:
current_elt ::= current_lhs = 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#
Current element 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 lhs: ForwardLHS#
Current element.
- 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.ForwardLHS(lhs: Identifier | Self)#
Bases:
SwanItem
forward construct:
current_lhs ::= id | [ current_lhs ]
- 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 lhs: Identifier | Self#
Returns current lhs as an Identifier or a ForwardLHS.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
Return#
- class ansys.scadeone.core.swan.ForwardReturnItem#
Bases:
SwanItem
Base class for returns_item.
- 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.ProtectedForwardReturnItem(data: str)#
Bases:
ProtectedItem
,ForwardReturnItem
forward construct: protected returns_item with {syntax% … %syntax} markup.
- 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 module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
Item clause#
- class ansys.scadeone.core.swan.ForwardReturnItemClause(item_clause: ForwardItemClause)#
Bases:
ForwardReturnItem
forward construct: returns_item ::= item_clause.
- 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 item_clause: ForwardItemClause#
Item clause.
- 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.ForwardItemClause(id: Identifier, last_default: ForwardLastDefault | None = None)#
Bases:
SwanItem
forward construct:
item_clause ::= id [[ : last_default ]]
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property id: Identifier#
Item_clause 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 last_default: ForwardLastDefault | None#
Item_clause last default.
- 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.ForwardLastDefault(last: Expression | None = None, default: Expression | None = None, shared: Expression | None = None)#
Bases:
SwanItem
forward construct: last_default.
- last_default ::= last = expr
- default = exprlast = expr default = exprlast = default = expr
- Parameters:
- last: common.Expression (optional)
last expression.
- default: common.Expression (optional)
default expression.
- shared: common.Expression (optional)
last and default share the same expression. shared cannot be used with last or default.
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property default: Expression | None#
Returns default expression or shared one.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
True when last = default = expr.
- property last: Expression | None#
Returns last expression or shared one.
- property module: ModuleBase#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBody
andModuleInterface
- property owner: Self#
Owner of current Swan construct.
Return shared expression.
Array clause#
- class ansys.scadeone.core.swan.ForwardReturnArrayClause(array_clause: ForwardArrayClause, return_id: Identifier | None = None)#
Bases:
ForwardReturnItem
forward construct:
returns_item ::= [[ id = ]] array_clause
- static set_owner(owner: Self, children: Self | Iterable[Self])#
Helper to set owner as the owner of each item in the Iterable items.
- property array_clause: ForwardArrayClause#
Array clause.
- 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 return_id: Identifier | None#
Identifier of clause, or None.
- class ansys.scadeone.core.swan.ForwardArrayClause(return_clause: ForwardItemClause | Self)#
Bases:
SwanItem
forward construct:
returns_clause ::= (( item_clause | array_clause )) array_clause ::= [ returns_clause ]
- 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 return_clause: ForwardItemClause | Self#
Return array_clause content.