summaryrefslogtreecommitdiff
path: root/web/assets/go.scm
blob: 56f676cc20f1ff4c546dec7004e0392147befef9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
; Go highlights, from tree-sitter/tree-sitter-go v0.25.0 queries/highlights.scm
; (MIT). Reordered — upstream is written first-pattern-wins, this engine paints
; later patterns over earlier ones — capture names mapped onto zed syntax keys,
; and the builtin-function #match? turned into #any-of?, which needs no regex.

["(" ")" "[" "]" "{" "}"] @punctuation.bracket
[";" "," "." ":"] @punctuation.delimiter
["--" "-" "-=" ":=" "!" "!=" "..." "*" "*=" "/" "/=" "&" "&&" "&=" "%" "%="
 "^" "^=" "+" "++" "+=" "<-" "<" "<<" "<<=" "<=" "=" "==" ">" ">=" ">>" ">>="
 "|" "|=" "||" "~"] @operator

["break" "case" "chan" "const" "continue" "default" "defer" "else"
 "fallthrough" "for" "func" "go" "goto" "if" "import" "interface" "map"
 "package" "range" "return" "select" "struct" "switch" "type" "var"] @keyword

(type_identifier) @type
(field_identifier) @property
(label_name) @label

(function_declaration name: (identifier) @function)
(method_declaration name: (field_identifier) @function.method)
(call_expression function: (identifier) @function)
(call_expression function: (selector_expression
  field: (field_identifier) @function.method))
((call_expression function: (identifier) @function.builtin)
 (#any-of? @function.builtin "append" "cap" "clear" "close" "complex" "copy"
  "delete" "imag" "len" "make" "max" "min" "new" "panic" "print" "println"
  "real" "recover"))

[(int_literal) (float_literal) (imaginary_literal)] @number
[(true) (false) (nil) (iota)] @constant
[(interpreted_string_literal) (raw_string_literal) (rune_literal)] @string
(escape_sequence) @string.escape
(comment) @comment