diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-05-02 02:57:49 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-05-02 02:57:49 -0400 |
commit | 46aa6b65376ea62deb1d5ea1611b59dc222a5141 (patch) | |
tree | e92b26bc2d2653b9009a230ee1d6b7ed1185e3a0 /tnslc/parse/token.tnsl | |
parent | 9478e157ec2cfe4de704b3bd78b07aee8824774f (diff) |
[TNSLC] AST Updates
- Change how string_equate works
- Call AST Node generator from main
- Flush out ast.tnsl
- Add a few initial methods to AST
- Move some code from token.tnsl to parse.tnsl
Diffstat (limited to 'tnslc/parse/token.tnsl')
-rw-r--r-- | tnslc/parse/token.tnsl | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/tnslc/parse/token.tnsl b/tnslc/parse/token.tnsl index ce2bcdb..92748d8 100644 --- a/tnslc/parse/token.tnsl +++ b/tnslc/parse/token.tnsl @@ -14,58 +14,6 @@ EXPRESS OR IMPLIED #/ -/# The various types of tokens #/ -; enum TOKEN_TYPE [int] { - LINESEP = 0, - INLNSEP = 1, - DELIMIT = 2, - AUGMENT = 3, - LITERAL = 4, - KEYTYPE = 5, - PREWORD = 6, - KEYWORD = 7, - DEFWORD = 8 -} - -/# Token struct definition #/ -; struct Token { - int - token_type, - line, - col, - - ~{}charp - data -} - -/; method Token - - /; print - ;tnsl.io.print("{ ") - ;tnsl.io.print(self.token_type) - ;tnsl.io.print(" ") - ;tnsl.io.print(self.data`) - ;tnsl.io.print(" ") - ;tnsl.io.print(self.line) - ;tnsl.io.print(" ") - ;tnsl.io.print(self.col) - ;tnsl.io.print(" } ") - ;/ - - /; operator delete - ;delete self.data - ;/ - - /; add_char (~{}charp part) - # ;uint l = len self.data` - # ;realloc self.data, l + len part - /;loop (int i = 0; i < len part`) [i++] - # ;self.data`{l + i} = part{i} - ;self.data`.append(part`{i}) - ;/ - ;/ -;/ - /# Reserved words and characters, as well as helper funcs for checking their token types. @@ -142,6 +90,7 @@ "raw", "asm", "inline", + "virtual", "delete", @@ -151,7 +100,8 @@ ;{}{}charp LITERALS = { "true", - "false" + "false", + "null" } ;{}charp RESERVED = "`~!#%^&*()-=+[]{}|;:,.<>/" |