nvim-treesitter/queries/cpp/highlights.scm

128 lines
2.4 KiB
Scheme
Raw Normal View History

2020-05-23 21:02:43 +02:00
((identifier) @field
(#match? @field "^_"))
2020-05-23 21:02:43 +02:00
((identifier) @field
(#match? @field "^m_"))
2020-05-23 21:02:43 +02:00
((identifier) @field
(#match? @field "_$"))
2020-05-23 21:02:43 +02:00
(parameter_declaration
declarator: (reference_declarator) @parameter)
; function(Foo ...foo)
2020-08-15 09:24:24 -05:00
(variadic_parameter_declaration
declarator: (variadic_declarator
(identifier) @parameter))
; int foo = 0
(optional_parameter_declaration
declarator: (identifier) @parameter)
2020-05-23 21:02:43 +02:00
;(field_expression) @parameter ;; How to highlight this?
(template_function
name: (identifier) @function)
(template_method
name: (field_identifier) @method)
(template_function
name: (scoped_identifier
name: (identifier) @function))
(namespace_identifier) @constant
2020-07-06 23:01:46 +02:00
((identifier) @type (#match? @type "^[A-Z]"))
2020-05-23 21:02:43 +02:00
((namespace_identifier) @type
(#match? @type "^[A-Z]"))
2020-05-23 21:02:43 +02:00
((namespace_identifier) @constant
2020-06-14 15:12:38 +02:00
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
2020-05-23 21:02:43 +02:00
(destructor_name
name: (_) @function)
2020-05-23 21:02:43 +02:00
(function_declarator
declarator: (scoped_identifier
name: (identifier) @function))
((function_declarator
declarator: (scoped_identifier
name: (identifier) @constructor))
(#match? @constructor "^[A-Z]"))
2020-05-23 21:02:43 +02:00
(call_expression
2020-08-15 09:24:24 -05:00
function: (scoped_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))
((call_expression
2020-08-15 09:24:24 -05:00
function: (scoped_identifier
2020-05-23 21:02:43 +02:00
name: (identifier) @constructor))
(#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
field: (field_identifier) @constructor))
(#match? @constructor "^[A-Z]"))
2020-05-23 21:02:43 +02:00
;; constructing a type in a intizializer list: Constructor (): **SuperType (1)**
((field_initializer
(field_identifier) @constructor
(argument_list))
(#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
(this) @constant.builtin
2020-05-23 21:02:43 +02:00
(nullptr) @constant
(true) @boolean
(false) @boolean
; Literals
(raw_string_literal) @string
2020-05-23 21:02:43 +02:00
; Keywords
[
"try"
"catch"
"noexcept"
"throw"
] @exception
2020-07-06 23:01:46 +02:00
[
"class"
2020-07-20 08:05:30 +02:00
"decltype"
"constexpr"
"delete"
"explicit"
"final"
"friend"
"mutable"
"namespace"
"new"
"override"
"private"
"protected"
"public"
"template"
"typename"
"using"
"virtual"
(auto)
] @keyword
2020-05-23 21:23:05 +02:00
"::" @operator
"..." @operator
; Annotations (not fully supported by parser)
((ERROR) @annotation
(vim-match? @annotation "\[?\[.*\]\]?.*$"))
(attribute) @annotation