summaryrefslogtreecommitdiff
path: root/tnslc/parse/token.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-04-13 17:29:33 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-04-13 17:29:33 -0400
commit658c2fa36f3359325665c744ebe57478d539b28d (patch)
tree84806babb5febe4a3306c9c0bfc0e4e9da1159e0 /tnslc/parse/token.tnsl
parent6674b44eb75218e1f00a1cc63a82aab82c641806 (diff)
Include ast, add function to print tokens
Diffstat (limited to 'tnslc/parse/token.tnsl')
-rw-r--r--tnslc/parse/token.tnsl16
1 files changed, 16 insertions, 0 deletions
diff --git a/tnslc/parse/token.tnsl b/tnslc/parse/token.tnsl
index 6c402fd..e18ade5 100644
--- a/tnslc/parse/token.tnsl
+++ b/tnslc/parse/token.tnsl
@@ -40,6 +40,18 @@
/; 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
;/
@@ -310,6 +322,10 @@
;return TOKEN_TYPE.DEFWORD
;;else if (len s` == 1)
+
+ /; if (is_digit(s`{0}))
+ ;return TOKEN_TYPE.LITERAL
+ ;/
/; if (is_in_string(~DELIMITS, s`{0}))
;return TOKEN_TYPE.DELIMIT