C/C++ highlights: update to new syntax

This changed the highlight of "switch" to conditional and of "break" to repeat.
This commit is contained in:
Stephan Seitz 2020-07-04 22:00:59 +02:00
parent e4cd88baa4
commit 97b855ccec
4 changed files with 99 additions and 87 deletions

View file

@ -1,24 +1,34 @@
"break" @keyword [
"case" @conditional "const"
"const" @keyword "default"
"continue" @repeat "enum"
"default" @keyword "extern"
"do" @repeat "inline"
"else" @conditional "return"
"enum" @keyword "sizeof"
"extern" @keyword "static"
"for" @repeat "struct"
"if" @conditional "typedef"
"inline" @keyword "union"
"return" @keyword "volatile"
"sizeof" @keyword ] @keyword
"static" @keyword
"struct" @keyword [
"switch" @keyword "while"
"typedef" @keyword "for"
"union" @keyword "do"
"volatile" @keyword "continue"
"while" @repeat "break"
] @repeat
[
"if"
"else"
"case"
"switch"
] @conditional
(conditional_expression [ "?" ":" ] @conditional)
"#define" @constant.macro "#define" @constant.macro
[ [
@ -32,45 +42,38 @@
(preproc_directive) (preproc_directive)
] @keyword ] @keyword
"--" @operator [
"-" @operator "--"
"->" @operator "-"
"!=" @operator "->"
"*" @operator "!="
"/" @operator "*"
"&" @operator "/"
"&&" @operator "&"
"+" @operator "&&"
"++" @operator "+"
"<" @operator "++"
"<=" @operator "<"
"==" @operator "<="
"=" @operator "=="
"~" @operator "="
">" @operator "~"
">=" @operator ">"
"!" @operator ">="
"||" @operator "!"
(conditional_expression [ "?" ":" ] @conditional) "||"
"-=" @operator "-="
"+=" @operator "+="
"*=" @operator "*="
"/=" @operator "/="
"|=" @operator "|="
"&=" @operator "&="
] @operator
"." @punctuation.delimiter [ "." ";" ":" "," ] @punctuation.delimiter
";" @punctuation.delimiter
":" @punctuation.delimiter
"," @punctuation.delimiter
"(" @punctuation.bracket [ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
")" @punctuation.bracket
"[" @punctuation.bracket
"]" @punctuation.bracket
"{" @punctuation.bracket
"}" @punctuation.bracket
(string_literal) @string (string_literal) @string
(system_lib_string) @string (system_lib_string) @string

View file

@ -31,9 +31,11 @@
(identifier) @reference (identifier) @reference
;; Scope ;; Scope
(for_statement) @scope [
(if_statement) @scope (for_statement)
(while_statement) @scope (if_statement)
(translation_unit) @scope (while_statement)
(function_definition) @scope (translation_unit)
(compound_statement) @scope ; a block in curly braces (function_definition)
(compound_statement) ; a block in curly braces
] @scope

View file

@ -60,7 +60,6 @@
(argument_list)) (argument_list))
(#match? @constructor "^[A-Z]")) (#match? @constructor "^[A-Z]"))
(auto) @keyword
; Constants ; Constants
@ -72,25 +71,33 @@
; Keywords ; Keywords
"catch" @exception [
"class" @keyword "try"
"constexpr" @keyword "catch"
"delete" @keyword "noexcept"
"explicit" @keyword "throw"
"final" @exception ] @exception
"friend" @keyword
"mutable" @keyword
"namespace" @keyword [
"noexcept" @keyword "class"
"new" @keyword "constexpr"
"override" @keyword "delete"
"private" @keyword "explicit"
"protected" @keyword "final"
"public" @keyword "friend"
"template" @keyword "mutable"
"throw" @keyword "namespace"
"try" @exception "new"
"typename" @keyword "override"
"using" @keyword "private"
"virtual" @keyword "protected"
"public"
"template"
"typename"
"using"
"virtual"
(auto)
] @keyword
"::" @operator "::" @operator

View file

@ -9,14 +9,14 @@
(struct_specifier (struct_specifier
name: (scoped_type_identifier name: (scoped_type_identifier
name: (type_identifier) @definition.type) ) name: (type_identifier) @definition.type))
(class_specifier (class_specifier
name: (type_identifier) @definition.type) name: (type_identifier) @definition.type)
(class_specifier (class_specifier
name: (scoped_type_identifier name: (scoped_type_identifier
name: (type_identifier) @definition.type) ) name: (type_identifier) @definition.type))
;; Function defintions ;; Function defintions
(template_function (template_function