diff options
Diffstat (limited to 'neb/structs.py')
| -rw-r--r-- | neb/structs.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/neb/structs.py b/neb/structs.py index 27c7782..51cdb34 100644 --- a/neb/structs.py +++ b/neb/structs.py @@ -47,6 +47,8 @@ class TokenType(Enum): MANY = auto() COLON = auto() + APOSTROPHE = auto() + @dataclass class Token: type_: TokenType @@ -127,6 +129,25 @@ class Symbol: else: return f"{self.name}" +class NebDef: + def __init__(self, symbol, type_=ALL_TYPES[":any"]): + self.name = symbol.name + self.symbol = symbol + self.line = symbol.line + self.type_ = type_ + def __str__(self): + return f"{self.name} (def)" + +class NebFuncDef: + def __init__(self, symbol, return_type, args, many, body): + self.name = symbol.name + self.symbol = symbol + self.line = symbol.line + self.return_type = return_type + self.args = args + self.many = many + self.body = body + class Expr: def __init__(self, args): self.args = args |
