diff options
| author | mryouse | 2022-07-26 01:03:57 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-26 01:03:57 +0000 |
| commit | 0de12784cfc54130e65812e64cbd9e975ceab9ff (patch) | |
| tree | 3142eb24095edcae0a2270f34a4fbdb83184741a /neb/structs.py | |
| parent | 80257143d7c33ed218ecb8ce916ea710b6b1f6fa (diff) | |
parse single quotes, as well as defs and funcs
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 |
