summaryrefslogtreecommitdiff
path: root/web/assets/go.scm
diff options
context:
space:
mode:
Diffstat (limited to 'web/assets/go.scm')
-rw-r--r--web/assets/go.scm34
1 files changed, 34 insertions, 0 deletions
diff --git a/web/assets/go.scm b/web/assets/go.scm
new file mode 100644
index 0000000..56f676c
--- /dev/null
+++ b/web/assets/go.scm
@@ -0,0 +1,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