From b72ce9a3fdfe956f566c8bdde1fceebe7601c59f Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Wed, 3 Feb 2021 17:31:10 -0500 Subject: fix syntax highlighting for ' number separator C++ --- syntax.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax.c b/syntax.c index 5d83cdb..01e6b7d 100644 --- a/syntax.c +++ b/syntax.c @@ -158,7 +158,8 @@ static void syntax_highlight_c_cpp(SyntaxState *state_ptr, bool cpp, char32_t *l char_types[i] = SYNTAX_CHARACTER; } } else if (!in_multi_line_comment && !in_single_line_comment && !in_string) { - in_char = true; + if (i == 0 || !is32_digit(line[i-1])) // in C++, you can use ' as a separator, e.g. 1'000'000 + in_char = true; } break; case ANY_DIGIT: -- cgit v1.2.3