aboutsummaryrefslogtreecommitdiff
path: root/neb/structs.py
diff options
context:
space:
mode:
authormryouse2022-07-09 02:39:27 +0000
committermryouse2022-07-09 02:39:27 +0000
commit4038aa87fddbe7e79c61603cf8d4514ebb47f3fe (patch)
tree8f5493f5fb8d9f9ea1de4cd1ade03b7d6c9447d9 /neb/structs.py
parent7ffeef0faef3fbc389069df853109afc76260f0d (diff)
parent4fb8873f45c8596ba044c87060191778b8238952 (diff)
Merge branch 'master' into feature/listtypes
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():