From e0dc018f66d230b37409d107cf3b314d7e42ad4c Mon Sep 17 00:00:00 2001 From: MasFlam Date: Fri, 18 Sep 2020 05:19:41 +0200 Subject: [PATCH] Fix some left-over details in C++ syntax highlighting (#1865) - move type cast keywords into operators, since that's their syntactic function - fix a single dot being matched as a constant.number - add the missing caret operator --- runtime/syntax/cpp.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/runtime/syntax/cpp.yaml b/runtime/syntax/cpp.yaml index 505886cb..c213baa3 100644 --- a/runtime/syntax/cpp.yaml +++ b/runtime/syntax/cpp.yaml @@ -10,7 +10,6 @@ rules: - type: "\\b(final|override)\\b" - type.keyword: "\\b(auto|volatile|const(expr|eval|init)?|mutable|register|thread_local|static|extern|decltype|explicit|virtual)\\b" - statement: "\\b(class|namespace|template|typename|this|friend|using|public|protected|private|noexcept)\\b" - - statement: "\\b((const|dynamic|reinterpret|static)_cast)\\b" - statement: "\\b(concept|requires)\\b" - statement: "\\b(import|export|module)\\b" - statement: "\\b(for|if|while|do|else|case|default|switch)\\b" @@ -25,15 +24,15 @@ rules: - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)" # Operator Color - - symbol.operator: "([.:;,+*~|=!?\\%]|<|>|/|-|&|\\b(sizeof|alignof|typeid|(and|or|xor|not)(_eq)?|bitor|compl|bitand)\\b)" + - symbol.operator: "[-+*/%=<>.:;,~&|^!?]|\\b(sizeof|alignof|typeid|(and|or|xor|not)(_eq)?|bitor|compl|bitand|(const|dynamic|reinterpret|static)_cast)\\b" # Parenthetical Color - symbol.brackets: "[(){}]|\\[|\\]" # Integer Literals - constant.number: "(\\b([1-9][0-9']*|0[0-7']*|0[Xx][0-9a-fA-F']+|0[Bb][01]+)([Uu]?[Ll][Ll]?|[Ll][Ll]?[Uu]?)?\\b)" # Decimal Floating-point Literals - - constant.number: "(\\b([0-9']*[.][0-9']*([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" + - constant.number: "(\\b(([0-9']*[.][0-9']+|[0-9']+[.][0-9']*)([Ee][+-]?[0-9']+)?|[0-9']+[Ee][+-]?[0-9']+)[FfLl]?\\b)" # Hexadecimal Floating-point Literals - - constant.number: "(\\b0[Xx]([0-9a-zA-Z']+[.][0-9a-zA-Z']*|[0-9a-zA-Z']*[.][0-9a-zA-Z']+)[Pp][+-]?[0-9']+[FfLl]?\\b)" + - constant.number: "(\\b0[Xx]([0-9a-zA-Z']*[.][0-9a-zA-Z']+|[0-9a-zA-Z']+[.][0-9a-zA-Z']*)[Pp][+-]?[0-9']+[FfLl]?\\b)" - constant.bool: "(\\b(true|false|NULL|nullptr)\\b)" - constant.string: