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, 8 insertions, 3 deletions
diff --git a/neb/structs.py b/neb/structs.py
index c623ed3..45e69a7 100644
--- a/neb/structs.py
+++ b/neb/structs.py
@@ -112,7 +112,7 @@ class Type:
else:
return self.name
-_native_types = ":any :literal :string :bool :number :int :float :[] :handle"
+_native_types = ":any :literal :string :bool :number :int :float :[] :handle :type"
ALL_TYPES = {x: Type(x) for x in _native_types.split(" ")}
class Symbol:
@@ -140,14 +140,13 @@ class List:
# function things
class Arg:
- def __init__(self, name, type_, *, optional=False, lazy=False):
+ def __init__(self, name, type_, *, optional=False):
self.name = name
if f"{type_}" == ":list":
self.type_ = ALL_TYPES[":[]"]
else:
self.type_ = ALL_TYPES[f"{type_}"]
self.optional = optional
- self.lazy = lazy
def __str__(self):
return f"{self.name} {self.type_}"
@@ -194,6 +193,12 @@ class Environment:
except:
raise NebPanic(f"undefined symbol: '{key}")
+ def get_all(self):
+ if self.parent is None:
+ return self.environment
+ else:
+ return dict(self.parent.get_all(), **self.environment)
+
def __str__(self):
out = ""
for k, v in self.environment.items():