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  "fn"
107  "asm"
108  "defer"
109  "errdefer"
110  "test"
111  "struct"
112  "union"
113  "enum"
114  "opaque"
115  "error"
116  "try"
117  "catch"
118  "for"
119  "while"
120  "break"
121  "continue"
122  "const"
123  "var"
124  "volatile"
125  "allowzero"
126  "noalias"
127  "addrspace"
128  "align"
129  "callconv"
130  "linksection"
131  "comptime"
132  "export"
133  "extern"
134  "inline"
135  "noinline"
136  "packed"
137  "pub"
138  "threadlocal"
139  "async"
140  "await"
141  "suspend"
142  "nosuspend"
143  "resume"
144  "and"
145  "or"
146  "orelse"
147  "return"
148  "if"
149  "else"
150  "switch"
151] @keyword
152
153[
154  "usingnamespace"
155] @constant
156
157[
158  "anytype"
159  "anyframe"
160  (BuildinTypeExpr)
161] @type
162
163[
164  "null"
165  "unreachable"
166  "undefined"
167] @constant
168
169[
170  (CompareOp)
171  (BitwiseOp)
172  (BitShiftOp)
173  (AdditionOp)
174  (AssignOp)
175  (MultiplyOp)
176  (PrefixOp)
177  "*"
178  "**"
179  "->"
180  ".?"
181  ".*"
182  "?"
183] @operator
184
185[
186  ";"
187  "."
188  ","
189  ":"
190] @punctuation.delimiter
191
192[
193  ".."
194  "..."
195] @punctuation.special
196
197[
198  "["
199  "]"
200  "("
201  ")"
202  "{"
203  "}"
204  (Payload "|")
205  (PtrPayload "|")
206  (PtrIndexPayload "|")
207] @punctuation.bracket
208
209; Error
210(ERROR) @error