From: Brendan Hansen Date: Wed, 8 Mar 2023 14:02:04 +0000 (-0600) Subject: added: error message for unclosed character literal X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=f69459f028c3a3be3a290f755815d9bb7764fea2;p=onyx.git added: error message for unclosed character literal --- diff --git a/compiler/src/lex.c b/compiler/src/lex.c index 3e4a91c7..7bf9aa1f 100644 --- a/compiler/src/lex.c +++ b/compiler/src/lex.c @@ -255,9 +255,11 @@ whitespace_skipped: while (!(*tokenizer->curr == ch && slash_count == 0)) { len++; - // if (*tokenizer->curr == '\n') { - // onyx_report_error(tk.pos, "String literal not terminated by end of line."); - // } + if (*tokenizer->curr == '\n' && ch == '\'') { + tk.pos.length = (u16) len; + onyx_report_error(tk.pos, Error_Critical, "Character literal not terminated by end of line."); + break; + } if (*tokenizer->curr == '\\') { slash_count += 1;