highlights.scm

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