Skip to content

system

Classes:

Cast

Cast(value: AST, target_type: Any)

Bases: Expr

Methods:

Source code in src/irx/system.py
69
70
71
72
def __init__(self, value: astx.AST, target_type: Any) -> None:
    super().__init__()
    self.value: astx.AST = value
    self.target_type: Any = target_type

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/system.py
74
75
76
77
78
79
80
81
82
83
84
85
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Return the structured representation of the cast expression.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    key = f"Cast[{self.target_type}]"
    value = self.value.get_struct(simplified)
    return self._prepare_struct(key, value, simplified)

PrintExpr

PrintExpr(message: Expr)

Bases: Expr

It would be nice to support more arguments similar to the ones supported by Python (*args, sep=' ', end='', file=None, flush=False).

Methods:

Source code in src/irx/system.py
29
30
31
32
33
34
35
36
37
38
def __init__(self, message: astx.Expr) -> None:
    """
    title: Initialize the PrintExpr.
    parameters:
      message:
        type: astx.Expr
    """
    super().__init__()
    self.message: astx.Expr = message
    self._name: str = f"print_msg_{next(PrintExpr._counter)}"

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/system.py
40
41
42
43
44
45
46
47
48
49
50
51
52
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Return the AST structure of the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    key = f"FunctionCall[{self}]"
    value = self.message.get_struct(simplified)

    return self._prepare_struct(key, value, simplified)