From 3d23b45a0ab381f34a2dae327e22cfa862af46ea Mon Sep 17 00:00:00 2001 From: mryouse Date: Fri, 13 May 2022 02:35:25 +0000 Subject: lists? not sure if they fully work, but somewhat --- tokens.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tokens.py') 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}]" + -- cgit v1.2.3