aboutsummaryrefslogtreecommitdiff
path: root/tokens.py
diff options
context:
space:
mode:
authormryouse2022-05-13 02:35:25 +0000
committermryouse2022-05-13 02:35:25 +0000
commit3d23b45a0ab381f34a2dae327e22cfa862af46ea (patch)
tree104bd1949d60947058b1208169b0372092b0f14c /tokens.py
parente18bdec21683adfb2658359568a54a2f3f21d703 (diff)
lists? not sure if they fully work, but somewhat
Diffstat (limited to 'tokens.py')
-rw-r--r--tokens.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tokens.py b/tokens.py
index 450ef99..de482c2 100644
--- a/tokens.py
+++ b/tokens.py
@@ -14,6 +14,7 @@ class NebType(Enum):
BOOL = auto()
EXPR = auto()
SYMBOL = auto()
+ LIST = auto()
def __str__(self):
return self.name.lower()
@@ -57,6 +58,14 @@ class NebClose(NebSeparator):
def __str__(self):
return ")"
+class NebListStart(NebSeparator):
+ def __str__(self):
+ return "["
+
+class NebListEnd(NebSeparator):
+ def __str__(self):
+ return "]"
+
class NebSymbol(NebBaseType):
def __init__(self, name):
@@ -119,3 +128,14 @@ class NebFloat(NebNumber):
def __init__(self, value):
super().__init__("float", NebType.FLOAT, value)
+class NebList(NebAny):
+ def __init__(self, items):
+ super().__init__("list", NebType.LIST)
+ self.items = items
+
+ def __str__(self):
+ out = "[ "
+ for item in self.items:
+ out += f"{item} "
+ return f"{out}]"
+