Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Support for Uint8 datatype #78

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/astx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
Int16,
Int32,
Int64,
UnsignedInteger,
UInt8,
Integer,
Literal,
LiteralBoolean,
Expand Down Expand Up @@ -129,6 +131,8 @@ def get_version() -> str:
"Int64",
"Int8",
"Integer",
"UnsignedInteger",
"UInt8",
"Literal",
"LiteralBoolean",
"LiteralInt16",
Expand Down
28 changes: 28 additions & 0 deletions src/astx/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ class Integer(Number):
"""Integer number data type expression."""


@public
class UnsignedInteger(Integer):
"""Unsigned integer number data type expression."""


@public
class SignedInteger(Integer):
"""Signed integer number data type expression."""
Expand Down Expand Up @@ -223,6 +228,13 @@ class Int128(SignedInteger):
nbytes: int = 16


@public
class UInt8(UnsignedInteger):
"""UInt8 data type expression."""

nbytes: int = 1


@public
class Floating(Number):
"""AST for the literal float number."""
Expand Down Expand Up @@ -352,6 +364,22 @@ def __init__(
self.loc = loc


@public
class LiteralUInt8(Literal):
"""LiteralUInt8 data type class."""

value: int

def __init__(
self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
"""Initialize LiteralUInt8."""
super().__init__(loc)
self.value = value
self.type_ = UInt8
self.loc = loc


@public
class LiteralBoolean(Literal):
"""LiteralBoolean data type class."""
Expand Down
Loading