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.
This commit is contained in:
@@ -296,3 +296,13 @@ pair<token_t, lerr_t> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user