diff options
| author | mryouse | 2022-05-13 02:35:25 +0000 | 
|---|---|---|
| committer | mryouse | 2022-05-13 02:35:25 +0000 | 
| commit | 3d23b45a0ab381f34a2dae327e22cfa862af46ea (patch) | |
| tree | 104bd1949d60947058b1208169b0372092b0f14c /tokens.py | |
| parent | e18bdec21683adfb2658359568a54a2f3f21d703 (diff) | |
lists? not sure if they fully work, but somewhat
Diffstat (limited to 'tokens.py')
| -rw-r--r-- | tokens.py | 20 | 
1 files changed, 20 insertions, 0 deletions
| @@ -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}]" + | 
