2021-04-08 16:18:25 +02:00
|
|
|
; Functions
|
|
|
|
|
2022-10-15 01:01:11 +02:00
|
|
|
; These casts are parsed as function calls, but are not.
|
|
|
|
((identifier) @keyword (#eq? @keyword "static_cast"))
|
|
|
|
((identifier) @keyword (#eq? @keyword "dynamic_cast"))
|
|
|
|
((identifier) @keyword (#eq? @keyword "reinterpret_cast"))
|
|
|
|
((identifier) @keyword (#eq? @keyword "const_cast"))
|
|
|
|
|
2021-04-08 16:18:25 +02:00
|
|
|
(call_expression
|
2021-10-29 07:11:19 +02:00
|
|
|
function: (qualified_identifier
|
2021-04-08 16:18:25 +02:00
|
|
|
name: (identifier) @function))
|
|
|
|
|
|
|
|
(template_function
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
|
|
|
(template_method
|
|
|
|
name: (field_identifier) @function)
|
|
|
|
|
|
|
|
(function_declarator
|
2021-10-29 07:11:19 +02:00
|
|
|
declarator: (qualified_identifier
|
2021-04-08 16:18:25 +02:00
|
|
|
name: (identifier) @function))
|
|
|
|
|
|
|
|
(function_declarator
|
2021-10-29 07:11:19 +02:00
|
|
|
declarator: (qualified_identifier
|
2022-10-14 03:31:32 +02:00
|
|
|
name: (qualified_identifier
|
|
|
|
name: (identifier) @function)))
|
2021-04-08 16:18:25 +02:00
|
|
|
|
|
|
|
(function_declarator
|
|
|
|
declarator: (field_identifier) @function)
|
|
|
|
|
|
|
|
; Types
|
|
|
|
|
2022-10-14 03:31:32 +02:00
|
|
|
(using_declaration ("using" "namespace" (identifier) @namespace))
|
|
|
|
(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace)))
|
2023-06-08 01:13:39 +02:00
|
|
|
(namespace_definition name: (namespace_identifier) @namespace)
|
2022-10-14 03:31:32 +02:00
|
|
|
(namespace_identifier) @namespace
|
|
|
|
|
|
|
|
(qualified_identifier name: (identifier) @type.enum.variant)
|
2021-04-08 16:18:25 +02:00
|
|
|
|
|
|
|
(auto) @type
|
2022-10-14 03:31:32 +02:00
|
|
|
"decltype" @type
|
2021-04-08 16:18:25 +02:00
|
|
|
|
2022-10-15 03:05:39 +02:00
|
|
|
(ref_qualifier ["&" "&&"] @type.builtin)
|
|
|
|
(reference_declarator ["&" "&&"] @type.builtin)
|
|
|
|
(abstract_reference_declarator ["&" "&&"] @type.builtin)
|
|
|
|
|
2021-04-08 16:18:25 +02:00
|
|
|
; Constants
|
|
|
|
|
|
|
|
(this) @variable.builtin
|
2022-10-14 03:31:32 +02:00
|
|
|
(nullptr) @constant.builtin
|
2021-04-08 16:18:25 +02:00
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
2022-10-14 03:31:32 +02:00
|
|
|
(template_argument_list (["<" ">"] @punctuation.bracket))
|
|
|
|
(template_parameter_list (["<" ">"] @punctuation.bracket))
|
|
|
|
(default_method_clause "default" @keyword)
|
|
|
|
|
|
|
|
"static_assert" @function.special
|
|
|
|
|
|
|
|
[
|
|
|
|
"<=>"
|
|
|
|
"[]"
|
|
|
|
"()"
|
|
|
|
] @operator
|
|
|
|
|
|
|
|
[
|
|
|
|
"co_await"
|
|
|
|
"co_return"
|
|
|
|
"co_yield"
|
|
|
|
"concept"
|
|
|
|
"delete"
|
|
|
|
"new"
|
|
|
|
"operator"
|
|
|
|
"requires"
|
|
|
|
"using"
|
|
|
|
] @keyword
|
|
|
|
|
|
|
|
[
|
|
|
|
"catch"
|
|
|
|
"noexcept"
|
|
|
|
"throw"
|
|
|
|
"try"
|
|
|
|
] @keyword.control.exception
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
"and"
|
|
|
|
"and_eq"
|
|
|
|
"bitor"
|
|
|
|
"bitand"
|
|
|
|
"not"
|
|
|
|
"not_eq"
|
|
|
|
"or"
|
|
|
|
"or_eq"
|
|
|
|
"xor"
|
|
|
|
"xor_eq"
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
|
|
[
|
|
|
|
"class"
|
|
|
|
"namespace"
|
|
|
|
"typename"
|
2022-10-15 01:01:11 +02:00
|
|
|
"template"
|
2022-10-14 03:31:32 +02:00
|
|
|
] @keyword.storage.type
|
|
|
|
|
|
|
|
[
|
|
|
|
"constexpr"
|
|
|
|
"constinit"
|
|
|
|
"consteval"
|
2022-10-15 01:01:11 +02:00
|
|
|
"mutable"
|
|
|
|
] @keyword.storage.modifier
|
|
|
|
|
|
|
|
; Modifiers that aren't plausibly type/storage related.
|
|
|
|
[
|
2022-10-14 03:31:32 +02:00
|
|
|
"explicit"
|
|
|
|
"friend"
|
2022-10-15 01:01:11 +02:00
|
|
|
"virtual"
|
|
|
|
(virtual_specifier) ; override/final
|
2022-10-14 03:31:32 +02:00
|
|
|
"private"
|
|
|
|
"protected"
|
|
|
|
"public"
|
2022-10-15 01:01:11 +02:00
|
|
|
"inline" ; C++ meaning differs from C!
|
|
|
|
] @keyword
|
2021-04-08 16:18:25 +02:00
|
|
|
|
|
|
|
; Strings
|
|
|
|
|
|
|
|
(raw_string_literal) @string
|
2022-10-14 03:31:32 +02:00
|
|
|
|
|
|
|
; inherits: c
|