aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 04:43:58 +0630
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 04:43:58 +0630
commit0385d4bb8dafe6c4968fcc83888b5dd3e18e861f (patch)
tree6c2751c104682421fef80bafc656cb7da8050ab9
parentf01d64b5f4d26611c90394f7b26ff219c4696c33 (diff)
downloadovm-0385d4bb8dafe6c4968fcc83888b5dd3e18e861f.tar.gz
ovm-0385d4bb8dafe6c4968fcc83888b5dd3e18e861f.tar.bz2
ovm-0385d4bb8dafe6c4968fcc83888b5dd3e18e861f.zip
Fix some off by one errors in lexer
-rw-r--r--asm/lexer.cpp4
1 files changed, 2 insertions, 2 deletions
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<token_t, lerr_t> 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<token_t, lerr_t> 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;