sql: Account for the single quotes in syntax highlighting

Previously, a String literal token like 'hello' had every char
highlighted but for the last 'o' and the closing single quote. This is
because the token start is at the opening single quote but the `length`
variable only accounted for the value length without the single quotes.
This commit is contained in:
Mahmoud Mandour 2021-09-18 17:38:29 +02:00 committed by Andreas Kling
parent 0e5b2c923d
commit aca87ce146
Notes: sideshowbarker 2024-07-18 03:04:21 +09:00

View file

@ -112,9 +112,8 @@ int main()
bool indenters_starting_line = true;
for (SQL::AST::Token token = lexer.next(); token.type() != SQL::AST::TokenType::Eof; token = lexer.next()) {
auto length = token.value().length();
auto start = token.start_position().column - 1;
auto end = start + length;
auto end = token.end_position().column - 1;
if (indenters_starting_line) {
if (token.type() != SQL::AST::TokenType::ParenClose)