diff options
Diffstat (limited to 'structs.py')
| -rw-r--r-- | structs.py | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -67,12 +67,29 @@ class Token: def __str__(self): return f"{self.type_.name} {self.text} {self.line}" +# Literals class Literal: def __init__(self, value): self.value = value def __str__(self): + return f"{self.value}:literal" + +class Int(Literal): + def __str__(self): + return f"{self.value}" + +class Float(Literal): + def __str__(self): return f"{self.value}" +class Bool(Literal): + def __str__(self): + return f"#{str(self.value).lower()}" + +class String(Literal): + def __str__(self): + return f'"{self.value}"' + class Type: def __init__(self, name): self.name = name @@ -90,4 +107,4 @@ class List: self.args = args self.data = data def __str__(self): - return "(" + " ".join(f"{arg}" for arg in self.args) + ")" + return "(" + ",".join(f"{arg}" for arg in self.args) + ")" |
