From 7a9e646d396cf8c4abbadb6e6df208bb96cd070c Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 14 Apr 2024 17:02:45 +0630 Subject: Implemented tokenise_literal_string One thing I've realised is that even methods such as this require error tracking. I won't implement it in the tokenise method as it's not related to consuming the string per se but instead in the main method. --- asm/lexer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/asm/lexer.cpp b/asm/lexer.cpp index 2bf7169..760f8db 100644 --- a/asm/lexer.cpp +++ b/asm/lexer.cpp @@ -296,3 +296,13 @@ pair tokenise_literal_char(string_view &source, size_t &column) } return make_pair(t, lerr_t::OK); } + +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)), + column}; + source.remove_prefix(end); + column += end + 1; + return token; +} -- cgit v1.2.3-13-gbd6f