From 83faf86312f10964fa607d07c10ea6a7a103dd59 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 15 Apr 2024 16:30:44 +0630 Subject: Fix error where lexer would loop infinitely if unknown character found --- asm/lexer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/asm/lexer.cpp b/asm/lexer.cpp index e463b7c..7529eaf 100644 --- a/asm/lexer.cpp +++ b/asm/lexer.cpp @@ -403,6 +403,12 @@ lerr_t tokenise_buffer(string_view source, std::vector &tokens) if (lerr.type != lerr_type_t::OK) return lerr; } + else + { + ++column; + return lerr_t{lerr_type_t::UNKNOWN_CHAR, column, line}; + } + if (is_token) { t.line = line; -- cgit v1.2.3-13-gbd6f