From: Brendan Hansen Date: Thu, 14 Oct 2021 17:19:09 +0000 (-0500) Subject: added completely escaped strings (""") X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=aabf26dffea69d3327e0514ab2a45ea827844db8;p=onyx.git added completely escaped strings (""") --- diff --git a/bin/onyx b/bin/onyx index 8c51fa88..6fa13f91 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/src/lex.c b/src/lex.c index 59b59735..b6bdfc39 100644 --- a/src/lex.c +++ b/src/lex.c @@ -207,6 +207,28 @@ whitespace_skipped: goto token_parsed; } + if (*tk.text == '"' && *(tk.text + 1) == '"' && *(tk.text + 2) == '"') { + u64 len = 0; + + INCREMENT_CURR_TOKEN(tokenizer); + INCREMENT_CURR_TOKEN(tokenizer); + INCREMENT_CURR_TOKEN(tokenizer); + + while (!(*tokenizer->curr == '"' && *(tokenizer->curr + 1) == '"' && *(tokenizer->curr + 2) == '"')) { + len++; + INCREMENT_CURR_TOKEN(tokenizer); + } + + INCREMENT_CURR_TOKEN(tokenizer); + INCREMENT_CURR_TOKEN(tokenizer); + INCREMENT_CURR_TOKEN(tokenizer); + + tk.text += 3; + tk.length = len; + tk.type = Token_Type_Literal_String; + goto token_parsed; + } + // String literal if (*tk.text == '"') { u64 len = 0;