From 0385d4bb8dafe6c4968fcc83888b5dd3e18e861f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 15 Apr 2024 04:43:58 +0630 Subject: Fix some off by one errors in lexer --- asm/lexer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'asm') diff --git a/asm/lexer.cpp b/asm/lexer.cpp index a8d0828..4e24ab7 100644 --- a/asm/lexer.cpp +++ b/asm/lexer.cpp @@ -214,7 +214,7 @@ pair tokenise_symbol(string_view &source, size_t &column) if (t.content == "") t.content = sym; t.column = column; - column += sym.size(); + column += sym.size() - 1; return make_pair(t, lerr_t::OK); } @@ -303,7 +303,7 @@ pair tokenise_literal_char(string_view &source, size_t &column) token_t tokenise_literal_string(string_view &source, size_t &column, size_t end) { source.remove_prefix(1); - token_t token{token_type_t::LITERAL_STRING, string(source.substr(1, end - 1)), + token_t token{token_type_t::LITERAL_STRING, string(source.substr(0, end - 1)), column}; source.remove_prefix(end); column += end + 1; -- cgit v1.2.3-13-gbd6f