From d2772d77ce3b0908495bb298a0597a02bf300d1d Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Tue, 5 Oct 2021 14:04:29 -0400 Subject: [Docs] FIP additions --- tnslc/src/parse/token.tnsl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'tnslc/src/parse/token.tnsl') 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 -- cgit v1.2.3