on b368df5 help sign in
helix/runtime/queries/cpp/highlights.scm
129 lines 2.3 kB history raw
1; Functions
3; These casts are parsed as function calls, but are not.
4((identifier) @keyword (#eq? @keyword "static_cast"))
5((identifier) @keyword (#eq? @keyword "dynamic_cast"))
6((identifier) @keyword (#eq? @keyword "reinterpret_cast"))
7((identifier) @keyword (#eq? @keyword "const_cast"))
9(call_expression
10 function: (qualified_identifier
11 name: (identifier) @function))
13(template_function
14 name: (identifier) @function)
16(template_method
17 name: (field_identifier) @function)
19(function_declarator
20 declarator: (qualified_identifier
21 name: (identifier) @function))
23(function_declarator
24 declarator: (qualified_identifier
25 name: (qualified_identifier
26 name: (identifier) @function)))
28(function_declarator
29 declarator: (field_identifier) @function)
31; Types
33(using_declaration ("using" "namespace" (identifier) @namespace))
34(using_declaration ("using" "namespace" (qualified_identifier name: (identifier) @namespace)))
35(namespace_definition name: (identifier) @namespace)
36(namespace_identifier) @namespace
38(qualified_identifier name: (identifier) @type.enum.variant)
40(auto) @type
41"decltype" @type
43(ref_qualifier ["&" "&&"] @type.builtin)
44(reference_declarator ["&" "&&"] @type.builtin)
45(abstract_reference_declarator ["&" "&&"] @type.builtin)
47; Constants
49(this) @variable.builtin
50(nullptr) @constant.builtin
52; Keywords
54(template_argument_list (["<" ">"] @punctuation.bracket))
55(template_parameter_list (["<" ">"] @punctuation.bracket))
56(default_method_clause "default" @keyword)
58"static_assert" @function.special
61 "<=>"
62 "[]"
63 "()"
64] @operator
67 "co_await"
68 "co_return"
69 "co_yield"
70 "concept"
71 "delete"
72 "new"
73 "operator"
74 "requires"
75 "using"
76] @keyword
79 "catch"
80 "noexcept"
81 "throw"
82 "try"
83] @keyword.control.exception
87 "and"
88 "and_eq"
89 "bitor"
90 "bitand"
91 "not"
92 "not_eq"
93 "or"
94 "or_eq"
95 "xor"
96 "xor_eq"
97] @keyword.operator
100 "class"
101 "namespace"
102 "typename"
103 "template"
104] @keyword.storage.type
107 "constexpr"
108 "constinit"
109 "consteval"
110 "mutable"
111] @keyword.storage.modifier
113; Modifiers that aren't plausibly type/storage related.
115 "explicit"
116 "friend"
117 "virtual"
118 (virtual_specifier) ; override/final
119 "private"
120 "protected"
121 "public"
122 "inline" ; C++ meaning differs from C!
123] @keyword
125; Strings
127(raw_string_literal) @string
129; inherits: c