aboutsummaryrefslogtreecommitdiff
path: root/neb/structs.py
diff options
context:
space:
mode:
Diffstat (limited to 'neb/structs.py')
-rw-r--r--neb/structs.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/neb/structs.py b/neb/structs.py
index 51cdb34..8c643b5 100644
--- a/neb/structs.py
+++ b/neb/structs.py
@@ -13,6 +13,8 @@ class TokenType(Enum):
CLOSE_PAREN = auto()
OPEN_BRACKET = auto()
CLOSE_BRACKET = auto()
+ OPEN_BRACE = auto()
+ CLOSE_BRACE = auto()
EOF = auto()
@@ -111,10 +113,15 @@ class Type:
return f":[:any]"
else:
return f":[{self.inner}]"
+ elif self.name == ":{}":
+ if self.inner is None:
+ return ":{:any}"
+ else:
+ return ":{" + f"{self.inner}" + "}"
else:
return self.name
-_native_types = ":any :literal :string :bool :number :int :float :[] :handle :type"
+_native_types = ":any :literal :string :bool :number :int :float :[] :{} :handle :type"
ALL_TYPES = {x: Type(x) for x in _native_types.split(" ")}
class Symbol:
@@ -151,7 +158,7 @@ class NebFuncDef:
class Expr:
def __init__(self, args):
self.args = args
- self.type_ = ALL_TYPES[":[]"] # TODO no it's not
+ self.type_ = ALL_TYPES[":{}"] # TODO no it's not
def __str__(self):
return "(" + " ".join(f"{arg}" for arg in self.args) + ")"