summaryrefslogtreecommitdiff
path: root/tnslc/tnslc.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-03-24 02:17:46 -0400
committerKyle Gunger <kgunger12@gmail.com>2023-03-24 02:17:46 -0400
commit5e0d74b70b15d63993539c07905e0a9ba8117b5b (patch)
tree24c9a908b3d5b4952b453f5884daa28788c1299d /tnslc/tnslc.tnsl
parent3442a2c5bbbf5ec604ef104e9ab92912db98f222 (diff)
Better character literal parsing
Diffstat (limited to 'tnslc/tnslc.tnsl')
-rw-r--r--tnslc/tnslc.tnsl9
1 files changed, 7 insertions, 2 deletions
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl
index 9853af6..df2eb54 100644
--- a/tnslc/tnslc.tnsl
+++ b/tnslc/tnslc.tnsl
@@ -134,6 +134,10 @@
;return 0
;/
+ /; if (str{1} !== '\\')
+ ;return str{1}
+ ;/
+
;uint8 cmp = str{2}
/; if (cmp == '\\')
;return '\\'
@@ -145,8 +149,9 @@
;return '\t'
;; else if (cmp == '0')
;return '\0'
+ ;; else if (cmp == '\'')
+ ;return '\''
;/
-
;/
/; unquote_str({}uint8 str) [{}uint8]
@@ -2427,7 +2432,7 @@
;v.name = l
;; else if (data{0} == '\'')
;v.data_type = {1, "uint8", "", {}, {}}
- ;v.location = unqote_char(tok`{start}.data)
+ ;v.location = unqote_char(data)
;; else if (string_equate(data, "true"))
;v.data_type = {1, "bool", "", {}, {}}
;v.location = 1