Skip to content

types

Collection of ASTx nodes used for types.

Modules:

  • base

    ASTx Data Types module.

  • boolean

    ASTx Data Types module.

  • casting

    AST types module.

  • numeric

    ASTx Data Types module.

  • operators

    ASTx Data Types module.

  • string

    ASTx Data Types module.

  • temporal

    ASTx Data Types module.

Classes:

  • AnyType

    Generic data type expression.

  • BinaryOp

    AST class for the binary operator.

  • Boolean

    Boolean data type expression.

  • Complex

    Base class for complex numbers.

  • Complex32

    Complex32 data type class.

  • Complex64

    Complex64 data type class.

  • DataTypeOps

    Overload some magic functions used for the main operations.

  • Date

    Date data type expression.

  • DateTime

    DateTime data type expression.

  • Float16

    Float16 data type expression.

  • Float32

    Float32 data type expression.

  • Float64

    Float64 data type expression.

  • Floating

    AST for the literal float number.

  • Int16

    Int16 data type expression.

  • Int32

    Int32 data type expression.

  • Int64

    Int64 data type expression.

  • Int8

    Int8 data type expression.

  • Integer

    Integer number data type expression.

  • Number

    Number data type expression.

  • SignedInteger

    Signed integer number data type expression.

  • Time

    Time data type expression.

  • Timestamp

    Timestamp data type expression.

  • TypeCastExpr

    AST class for type casting expressions.

  • UInt128

    UInt128 data type expression.

  • UInt16

    UInt16 data type expression.

  • UInt32

    UInt32 data type expression.

  • UInt64

    UInt64 data type expression.

  • UInt8

    UInt8 data type expression.

  • UTF8Char

    Class for UTF-8 encoded characters.

  • UTF8String

    Class for UTF-8 encoded strings.

  • UnaryOp

    AST class for the unary operator.

  • UnsignedInteger

    Unsigned integer number data type expression.

AnyType

AnyType(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: DataType

Generic data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

BinaryOp

BinaryOp(op_code: str, lhs: DataType, rhs: DataType, loc: SourceLocation = NO_SOURCE_LOCATION)

Bases: DataTypeOps

AST class for the binary operator.

Methods:

  • get_struct

    Return the AST structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/types/operators.py
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
def __init__(
    self,
    op_code: str,
    lhs: DataType,
    rhs: DataType,
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """Initialize the BinaryOp instance."""
    super().__init__()

    self.loc = loc
    self.op_code = op_code
    self.lhs = lhs
    self.rhs = rhs
    self.kind = ASTKind.BinaryOpKind

    if not (
        isinstance(lhs.type_, DataType) and isinstance(rhs.type_, DataType)
    ):
        raise Exception(
            "For now, binary operators are just allowed for `DataType`."
            f"LHS: {lhs.type_}, RHS: {rhs.type_}"
        )

    if lhs.type_ == rhs.type_:
        self.type_ = lhs.type_
    else:
        # type inference
        self.type_ = max([lhs.type_, rhs.type_], key=lambda v: v.nbytes)

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return the AST structure that represents the object.

Source code in src/astx/types/operators.py
158
159
160
161
162
163
164
165
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return the AST structure that represents the object."""
    key = f"BINARY[{self.op_code}]"
    lhs = {"lhs": self.lhs.get_struct(simplified)}
    rhs = {"rhs": self.rhs.get_struct(simplified)}

    content: ReprStruct = {**lhs, **rhs}
    return self._prepare_struct(key, content, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Boolean

Boolean(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: AnyType

Boolean data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Complex

Complex(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Number

Base class for complex numbers.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Complex32

Complex32(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Complex

Complex32 data type class.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Complex64

Complex64(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Complex

Complex64 data type class.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

DataTypeOps

DataTypeOps(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: DataType

Overload some magic functions used for the main operations.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Date

Date(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Temporal

Date data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

DateTime

DateTime(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Temporal

DateTime data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Float16

Float16(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Floating

Float16 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Float32

Float32(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Floating

Float32 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Float64

Float64(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Floating

Float64 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Floating

Floating(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Number

AST for the literal float number.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Int16

Int16(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: SignedInteger

Int16 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Int32

Int32(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: SignedInteger

Int32 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Int64

Int64(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: SignedInteger

Int64 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Int8

Int8(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: SignedInteger

Int8 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Integer

Integer(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: AnyType

Integer number data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Number

Number(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: AnyType

Number data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

SignedInteger

SignedInteger(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Integer

Signed integer number data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Time

Time(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Temporal

Time data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

Timestamp

Timestamp(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Temporal

Timestamp data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

TypeCastExpr

TypeCastExpr(expr: Expr, target_type: DataType, loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Expr

AST class for type casting expressions.

Methods:

  • get_struct

    Return the AST structure of the TypeCast expression.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/types/casting.py
29
30
31
32
33
34
35
36
37
38
39
def __init__(
    self,
    expr: Expr,
    target_type: DataType,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc=loc, parent=parent)
    self.expr = expr
    self.target_type = target_type
    self.kind = ASTKind.TypeCastExprKind

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return the AST structure of the TypeCast expression.

Source code in src/astx/types/casting.py
45
46
47
48
49
50
51
52
53
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return the AST structure of the TypeCast expression."""
    key = "TypeCastExpr"
    value: ReprStruct = {
        "expression": self.expr.get_struct(simplified),
        "target_type": self.target_type.get_struct(simplified),
    }

    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UInt128

UInt128(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: UnsignedInteger

UInt128 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UInt16

UInt16(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: UnsignedInteger

UInt16 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UInt32

UInt32(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: UnsignedInteger

UInt32 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UInt64

UInt64(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: UnsignedInteger

UInt64 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UInt8

UInt8(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: UnsignedInteger

UInt8 data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UTF8Char

UTF8Char(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: AnyType

Class for UTF-8 encoded characters.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UTF8String

UTF8String(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: AnyType

Class for UTF-8 encoded strings.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UnaryOp

UnaryOp(op_code: str, operand: DataType, loc: SourceLocation = NO_SOURCE_LOCATION)

Bases: DataTypeOps

AST class for the unary operator.

Methods:

  • get_struct

    Return the AST structure of the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/types/operators.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
def __init__(
    self,
    op_code: str,
    operand: DataType,
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """Initialize the UnaryOp instance."""
    super().__init__()
    self.loc = loc
    self.op_code = op_code
    self.operand = operand
    self.kind = ASTKind.UnaryOpKind

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return the AST structure of the object.

Source code in src/astx/types/operators.py
110
111
112
113
114
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return the AST structure of the object."""
    key = f"UNARY[{self.op_code}]"
    value = self.operand.get_struct(simplified)
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )

UnsignedInteger

UnsignedInteger(loc: SourceLocation = NO_SOURCE_LOCATION, parent: Optional[ASTNodes] = None)

Bases: Integer

Unsigned integer number data type expression.

Methods:

  • get_struct

    Return a simple structure that represents the object.

  • to_json

    Return an json string that represents the object.

  • to_yaml

    Return an yaml string that represents the object.

Source code in src/astx/base.py
388
389
390
391
392
393
394
395
396
397
398
def __init__(
    self,
    loc: SourceLocation = NO_SOURCE_LOCATION,
    parent: Optional[ASTNodes] = None,
) -> None:
    super().__init__(loc)
    self.name = f"temp_{DataType._tmp_id}"
    DataType._tmp_id += 1
    # set it as a generic data type
    self.type_: ExprType = ExprType()
    self.parent = parent

get_struct

get_struct(simplified: bool = False) -> ReprStruct

Return a simple structure that represents the object.

Source code in src/astx/base.py
404
405
406
407
408
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """Return a simple structure that represents the object."""
    key = f"DATA-TYPE[{self.__class__.__name__}]"
    value = self.name
    return self._prepare_struct(key, value, simplified)

to_json

to_json(simplified: bool = False) -> str

Return an json string that represents the object.

Source code in src/astx/base.py
265
266
267
def to_json(self, simplified: bool = False) -> str:
    """Return an json string that represents the object."""
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str

Return an yaml string that represents the object.

Source code in src/astx/base.py
259
260
261
262
263
def to_yaml(self, simplified: bool = False) -> str:
    """Return an yaml string that represents the object."""
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )