summaryrefslogtreecommitdiff
path: root/tnslc/src/parse/token.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-10-05 14:04:29 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-10-05 14:04:29 -0400
commitd2772d77ce3b0908495bb298a0597a02bf300d1d (patch)
tree24524d91b375a02313ff0c2a25bedbd5434895d9 /tnslc/src/parse/token.tnsl
parent3add402da9fc5b574f34e37e951779212ce28ed1 (diff)
[Docs] FIP additions
Diffstat (limited to 'tnslc/src/parse/token.tnsl')
-rw-r--r--tnslc/src/parse/token.tnsl18
1 files changed, 13 insertions, 5 deletions
diff --git a/tnslc/src/parse/token.tnsl b/tnslc/src/parse/token.tnsl
index a841f58..cbbb31f 100644
--- a/tnslc/src/parse/token.tnsl
+++ b/tnslc/src/parse/token.tnsl
@@ -30,9 +30,9 @@
/# Token struct definition #/
;raw struct Token {
uint
- type,
+ token_type,
line,
- char,
+ col,
~{}charp
data
@@ -43,6 +43,14 @@
/; operator delete
;delete this.data
;/
+
+ /; add_char (`{}charp part)
+ ;uint l = len `this.data
+ ;realloc this.data, l + len part
+ /;loop (uint i = 0; i < len part) [i++]
+ `this.data{l + i} = part{i}
+ ;/
+ ;/
;/
/#
@@ -206,7 +214,7 @@
#; is_in_string (`const {}charp cmp, charp p) [bool]
- /; for (int i = 0; i < len cmp) [i++]
+ /; loop (int i = 0; i < len cmp) [i++]
/; if (s == cmp{i})
;return true
@@ -222,11 +230,11 @@
#; is_in_string_list (`const {}{}charp cmp, `{}charp s) [bool]
- /; for (int i = 0; i < len cmp) [i++]
+ /; loop (int i = 0; i < len cmp) [i++]
/; if (len s == len cmp{i})
- /; for (int j = 0; j < len s) [j++]
+ /; loop (int j = 0; j < len s) [j++]
/; if (s{j} !== cmp{i}{j})
;goto cont_outer