aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 16:30:44 +0630
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 16:30:44 +0630
commit83faf86312f10964fa607d07c10ea6a7a103dd59 (patch)
tree5f06b87bc09c37c7977155e42b8213ed7f713037
parent0f430e399c2a626f9fff72ac0e4ba56f2f4df34d (diff)
downloadovm-83faf86312f10964fa607d07c10ea6a7a103dd59.tar.gz
ovm-83faf86312f10964fa607d07c10ea6a7a103dd59.tar.bz2
ovm-83faf86312f10964fa607d07c10ea6a7a103dd59.zip
Fix error where lexer would loop infinitely if unknown character found
-rw-r--r--asm/lexer.cpp6
1 files changed, 6 insertions, 0 deletions
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<token_t *> &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;