highlights.scm

  1[
  2  (container_doc_comment)
  3  (doc_comment)
  4
  5] @comment.doc
  6
  7[
  8    (line_comment)
  9] @comment
 10
 11[
 12  variable: (IDENTIFIER)
 13  variable_type_function: (IDENTIFIER)
 14] @variable
 15
 16;; func parameter
 17parameter: (IDENTIFIER) @property
 18
 19[
 20  field_member: (IDENTIFIER)
 21  field_access: (IDENTIFIER)
 22] @property
 23
 24;; assume TitleCase is a type
 25(
 26  [
 27    variable_type_function: (IDENTIFIER)
 28    field_access: (IDENTIFIER)
 29    parameter: (IDENTIFIER)
 30  ] @type
 31  (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)+$")
 32)
 33
 34;; assume camelCase is a function
 35(
 36  [
 37    variable_type_function: (IDENTIFIER)
 38    field_access: (IDENTIFIER)
 39    parameter: (IDENTIFIER)
 40  ] @function
 41  (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$")
 42)
 43
 44;; assume all CAPS_1 is a constant
 45(
 46  [
 47    variable_type_function: (IDENTIFIER)
 48    field_access: (IDENTIFIER)
 49  ] @constant
 50  (#match? @constant "^[A-Z][A-Z_0-9]+$")
 51)
 52
 53[
 54  function_call: (IDENTIFIER)
 55  function: (IDENTIFIER)
 56] @function
 57
 58exception: "!" @keyword
 59
 60(
 61  (IDENTIFIER) @variable.special
 62  (#eq? @variable.special "_")
 63)
 64
 65(PtrTypeStart "c" @variable.special)
 66
 67(
 68  (ContainerDeclType
 69    [
 70      (ErrorUnionExpr)
 71      "enum"
 72    ]
 73  )
 74  (ContainerField (IDENTIFIER) @constant)
 75)
 76
 77field_constant: (IDENTIFIER) @constant
 78
 79(BUILTINIDENTIFIER) @keyword
 80
 81((BUILTINIDENTIFIER) @function
 82  (#any-of? @function "@import" "@cImport"))
 83
 84(INTEGER) @number
 85
 86(FLOAT) @number
 87
 88[
 89  "true"
 90  "false"
 91] @boolean
 92
 93[
 94  (LINESTRING)
 95  (STRINGLITERALSINGLE)
 96] @string
 97
 98(CHAR_LITERAL) @string.special.symbol
 99(EscapeSequence) @string.escape
100(FormatSequence) @string.special
101
102(BreakLabel (IDENTIFIER) @tag)
103(BlockLabel (IDENTIFIER) @tag)
104
105[
106  "asm"
107  "defer"
108  "errdefer"
109  "test"
110  "struct"
111  "union"
112  "enum"
113  "opaque"
114  "error"
115] @keyword
116
117[
118  "async"
119  "await"
120  "suspend"
121  "nosuspend"
122  "resume"
123] @keyword.coroutine
124
125[
126  "fn"
127] @keyword
128
129[
130  "and"
131  "or"
132  "orelse"
133] @operator
134
135[
136  "return"
137] @keyword.return
138
139[
140  "if"
141  "else"
142  "switch"
143] @keyword.control
144
145[
146  "for"
147  "while"
148  "break"
149  "continue"
150] @keyword
151
152[
153  "usingnamespace"
154] @constant
155
156[
157  "try"
158  "catch"
159] @keyword
160
161[
162  "anytype"
163  "anyframe"
164  (BuildinTypeExpr)
165] @type
166
167[
168  "const"
169  "var"
170  "volatile"
171  "allowzero"
172  "noalias"
173] @keyword
174
175[
176  "addrspace"
177  "align"
178  "callconv"
179  "linksection"
180] @keyword.storage
181
182[
183  "comptime"
184  "export"
185  "extern"
186  "inline"
187  "noinline"
188  "packed"
189  "pub"
190  "threadlocal"
191] @keyword
192
193[
194  "null"
195  "unreachable"
196  "undefined"
197] @constant
198
199[
200  (CompareOp)
201  (BitwiseOp)
202  (BitShiftOp)
203  (AdditionOp)
204  (AssignOp)
205  (MultiplyOp)
206  (PrefixOp)
207  "*"
208  "**"
209  "->"
210  ".?"
211  ".*"
212  "?"
213] @operator
214
215[
216  ";"
217  "."
218  ","
219  ":"
220] @punctuation.delimiter
221
222[
223  ".."
224  "..."
225] @punctuation.special
226
227[
228  "["
229  "]"
230  "("
231  ")"
232  "{"
233  "}"
234  (Payload "|")
235  (PtrPayload "|")
236  (PtrIndexPayload "|")
237] @punctuation.bracket
238
239; Error
240(ERROR) @error