2020-10-06 20:03:39 +02:00
|
|
|
; inherits: c
|
|
|
|
|
|
2020-05-23 21:02:43 +02:00
|
|
|
((identifier) @field
|
2021-04-23 17:33:00 +02:00
|
|
|
(#match? @field "(^_|^m_|_$)"))
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2020-08-22 21:17:07 +02:00
|
|
|
(parameter_declaration
|
|
|
|
|
declarator: (reference_declarator) @parameter)
|
2020-07-20 08:00:28 +02:00
|
|
|
; function(Foo ...foo)
|
2020-08-15 09:24:24 -05:00
|
|
|
(variadic_parameter_declaration
|
|
|
|
|
declarator: (variadic_declarator
|
2020-10-13 19:24:07 +02:00
|
|
|
(_) @parameter))
|
2020-08-15 09:24:24 -05:00
|
|
|
; int foo = 0
|
|
|
|
|
(optional_parameter_declaration
|
2020-10-13 19:24:07 +02:00
|
|
|
declarator: (_) @parameter)
|
2020-07-20 08:00:28 +02:00
|
|
|
|
2020-05-23 21:02:43 +02:00
|
|
|
;(field_expression) @parameter ;; How to highlight this?
|
|
|
|
|
(template_function
|
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
|
2021-09-26 16:40:50 -05:00
|
|
|
(template_method
|
|
|
|
|
name: (field_identifier) @method)
|
|
|
|
|
|
2020-09-12 16:27:38 +02:00
|
|
|
(((field_expression
|
|
|
|
|
(field_identifier) @method)) @_parent
|
2020-11-18 19:07:24 +01:00
|
|
|
(#has-parent? @_parent template_method function_declarator call_expression))
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2020-11-19 09:50:47 -06:00
|
|
|
(field_initializer
|
|
|
|
|
(field_identifier) @property)
|
|
|
|
|
|
|
|
|
|
(function_declarator
|
|
|
|
|
declarator: (field_identifier) @method)
|
|
|
|
|
|
2021-11-28 18:05:18 +01:00
|
|
|
(concept_definition
|
|
|
|
|
name: (identifier) @type)
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2020-09-22 23:01:19 +02:00
|
|
|
(namespace_identifier) @namespace
|
2020-05-23 21:02:43 +02:00
|
|
|
((namespace_identifier) @type
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @type "^[A-Z]"))
|
2020-05-23 21:02:43 +02:00
|
|
|
((namespace_identifier) @constant
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
2020-09-22 23:01:19 +02:00
|
|
|
(namespace_definition
|
|
|
|
|
name: (identifier) @namespace)
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2021-09-24 10:03:28 -05:00
|
|
|
(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @namespace)
|
2021-04-26 00:35:16 +02:00
|
|
|
|
2020-05-23 21:02:43 +02:00
|
|
|
(destructor_name
|
2021-01-07 23:33:32 +01:00
|
|
|
(identifier) @method)
|
2020-05-23 21:02:43 +02:00
|
|
|
|
|
|
|
|
(function_declarator
|
2021-09-24 10:03:28 -05:00
|
|
|
declarator: (qualified_identifier
|
2020-05-23 21:02:43 +02:00
|
|
|
name: (identifier) @function))
|
|
|
|
|
((function_declarator
|
2021-09-24 10:03:28 -05:00
|
|
|
declarator: (qualified_identifier
|
2020-05-23 21:02:43 +02:00
|
|
|
name: (identifier) @constructor))
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constructor "^[A-Z]"))
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2020-09-08 21:09:51 +02:00
|
|
|
(operator_name) @function
|
2021-07-06 12:59:03 +02:00
|
|
|
"static_assert" @function.builtin
|
2020-09-08 21:09:51 +02:00
|
|
|
|
2020-05-23 21:02:43 +02:00
|
|
|
(call_expression
|
2021-09-24 10:03:28 -05:00
|
|
|
function: (qualified_identifier
|
2020-05-23 21:02:43 +02:00
|
|
|
name: (identifier) @function))
|
|
|
|
|
|
|
|
|
|
(call_expression
|
2020-08-15 09:24:24 -05:00
|
|
|
function: (field_expression
|
2020-05-23 21:02:43 +02:00
|
|
|
field: (field_identifier) @function))
|
|
|
|
|
|
2021-01-29 16:31:27 +01:00
|
|
|
((call_expression
|
|
|
|
|
function: (identifier) @constructor)
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constructor "^[A-Z]"))
|
2020-05-23 21:02:43 +02:00
|
|
|
((call_expression
|
2021-09-24 10:03:28 -05:00
|
|
|
function: (qualified_identifier
|
2020-05-23 21:02:43 +02:00
|
|
|
name: (identifier) @constructor))
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constructor "^[A-Z]"))
|
2020-05-23 21:02:43 +02:00
|
|
|
|
|
|
|
|
((call_expression
|
2020-08-15 09:24:24 -05:00
|
|
|
function: (field_expression
|
2020-06-07 13:13:24 +02:00
|
|
|
field: (field_identifier) @constructor))
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constructor "^[A-Z]"))
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2021-09-24 10:03:28 -05:00
|
|
|
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
2020-05-23 21:02:43 +02:00
|
|
|
((field_initializer
|
|
|
|
|
(field_identifier) @constructor
|
|
|
|
|
(argument_list))
|
2021-11-18 09:51:03 +00:00
|
|
|
(#lua-match? @constructor "^[A-Z]"))
|
2020-05-23 21:02:43 +02:00
|
|
|
|
2020-05-23 21:23:05 +02:00
|
|
|
|
2020-05-23 21:02:43 +02:00
|
|
|
; Constants
|
|
|
|
|
|
2020-09-12 20:57:01 +02:00
|
|
|
(this) @variable.builtin
|
2020-05-23 21:02:43 +02:00
|
|
|
(nullptr) @constant
|
|
|
|
|
|
|
|
|
|
(true) @boolean
|
|
|
|
|
(false) @boolean
|
|
|
|
|
|
2020-08-13 09:48:59 +02:00
|
|
|
; Literals
|
|
|
|
|
|
|
|
|
|
(raw_string_literal) @string
|
|
|
|
|
|
2020-05-23 21:02:43 +02:00
|
|
|
; Keywords
|
|
|
|
|
|
2020-07-04 22:00:59 +02:00
|
|
|
[
|
|
|
|
|
"try"
|
|
|
|
|
"catch"
|
|
|
|
|
"noexcept"
|
|
|
|
|
"throw"
|
|
|
|
|
] @exception
|
2020-07-06 23:01:46 +02:00
|
|
|
|
2020-07-04 22:00:59 +02:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"class"
|
2020-07-20 08:05:30 +02:00
|
|
|
"decltype"
|
2020-07-04 22:00:59 +02:00
|
|
|
"constexpr"
|
|
|
|
|
"explicit"
|
|
|
|
|
"final"
|
|
|
|
|
"friend"
|
|
|
|
|
"mutable"
|
|
|
|
|
"namespace"
|
|
|
|
|
"override"
|
|
|
|
|
"private"
|
|
|
|
|
"protected"
|
|
|
|
|
"public"
|
|
|
|
|
"template"
|
|
|
|
|
"typename"
|
|
|
|
|
"using"
|
|
|
|
|
"virtual"
|
2021-09-16 18:18:49 +02:00
|
|
|
"co_await"
|
2021-11-28 18:05:18 +01:00
|
|
|
"concept"
|
|
|
|
|
"requires"
|
2022-01-17 09:15:01 +01:00
|
|
|
"consteval"
|
|
|
|
|
"constinit"
|
2020-07-04 22:00:59 +02:00
|
|
|
(auto)
|
|
|
|
|
] @keyword
|
|
|
|
|
|
2021-09-16 18:19:11 +02:00
|
|
|
[
|
|
|
|
|
"co_yield"
|
|
|
|
|
"co_return"
|
|
|
|
|
] @keyword.return
|
|
|
|
|
|
2020-09-13 15:08:11 +02:00
|
|
|
[
|
|
|
|
|
"new"
|
|
|
|
|
"delete"
|
|
|
|
|
|
|
|
|
|
;; these keywords are not supported by the parser
|
|
|
|
|
;"eq"
|
|
|
|
|
;"not_eq"
|
|
|
|
|
;
|
|
|
|
|
;"compl"
|
|
|
|
|
;"and"
|
|
|
|
|
;"or"
|
|
|
|
|
;
|
|
|
|
|
;"bitand"
|
|
|
|
|
;"bitand_eq"
|
|
|
|
|
;"bitor"
|
|
|
|
|
;"bitor_eq"
|
|
|
|
|
;"xor"
|
|
|
|
|
;"xor_eq"
|
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
2022-01-17 09:15:01 +01:00
|
|
|
[
|
|
|
|
|
"<=>"
|
|
|
|
|
"::"
|
|
|
|
|
] @operator
|
2021-09-17 01:01:28 +02:00
|
|
|
|
|
|
|
|
(attribute_declaration) @attribute
|
2021-09-24 23:30:01 +02:00
|
|
|
|
|
|
|
|
(literal_suffix) @operator
|