From f69459f028c3a3be3a290f755815d9bb7764fea2 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 8 Mar 2023 08:02:04 -0600 Subject: [PATCH] added: error message for unclosed character literal --- compiler/src/lex.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; -- 2.25.1