2021-04-09 12:42:49 +04:00
|
|
|
; Function calls
|
|
|
|
|
|
|
|
(call_expression
|
|
|
|
function: (identifier) @function)
|
|
|
|
|
|
|
|
(call_expression
|
|
|
|
function: (selector_expression
|
|
|
|
field: (field_identifier) @function.method))
|
|
|
|
|
|
|
|
; Function definitions
|
|
|
|
|
|
|
|
(function_declaration
|
|
|
|
name: (identifier) @function)
|
|
|
|
|
|
|
|
(method_declaration
|
|
|
|
name: (field_identifier) @function.method)
|
|
|
|
|
|
|
|
; Identifiers
|
|
|
|
|
2021-09-02 10:11:45 +04:00
|
|
|
((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
|
|
|
|
(const_spec
|
|
|
|
name: (identifier) @constant)
|
|
|
|
|
2021-09-06 13:13:52 +04:00
|
|
|
(parameter_declaration (identifier) @variable.parameter)
|
|
|
|
(variadic_parameter_declaration (identifier) @variable.parameter)
|
|
|
|
|
2021-04-09 12:42:49 +04:00
|
|
|
(type_identifier) @type
|
2021-11-03 07:00:52 +04:00
|
|
|
(field_identifier) @variable.other.member
|
2021-04-09 12:42:49 +04:00
|
|
|
(identifier) @variable
|
2021-09-02 10:11:45 +04:00
|
|
|
(package_identifier) @variable
|
|
|
|
|
2021-04-09 12:42:49 +04:00
|
|
|
|
|
|
|
; Operators
|
|
|
|
|
|
|
|
[
|
|
|
|
"--"
|
|
|
|
"-"
|
|
|
|
"-="
|
|
|
|
":="
|
|
|
|
"!"
|
|
|
|
"!="
|
|
|
|
"..."
|
|
|
|
"*"
|
|
|
|
"*"
|
|
|
|
"*="
|
|
|
|
"/"
|
|
|
|
"/="
|
|
|
|
"&"
|
|
|
|
"&&"
|
|
|
|
"&="
|
|
|
|
"%"
|
|
|
|
"%="
|
|
|
|
"^"
|
|
|
|
"^="
|
|
|
|
"+"
|
|
|
|
"++"
|
|
|
|
"+="
|
|
|
|
"<-"
|
|
|
|
"<"
|
|
|
|
"<<"
|
|
|
|
"<<="
|
|
|
|
"<="
|
|
|
|
"="
|
|
|
|
"=="
|
|
|
|
">"
|
|
|
|
">="
|
|
|
|
">>"
|
|
|
|
">>="
|
|
|
|
"|"
|
|
|
|
"|="
|
|
|
|
"||"
|
|
|
|
] @operator
|
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
|
|
|
[
|
|
|
|
"break"
|
|
|
|
"case"
|
|
|
|
"chan"
|
|
|
|
"const"
|
|
|
|
"continue"
|
|
|
|
"default"
|
|
|
|
"defer"
|
|
|
|
"else"
|
|
|
|
"fallthrough"
|
|
|
|
"for"
|
|
|
|
"func"
|
|
|
|
"go"
|
|
|
|
"goto"
|
|
|
|
"if"
|
|
|
|
"interface"
|
|
|
|
"map"
|
|
|
|
"range"
|
|
|
|
"return"
|
|
|
|
"select"
|
|
|
|
"struct"
|
|
|
|
"switch"
|
|
|
|
"type"
|
|
|
|
"var"
|
|
|
|
] @keyword
|
|
|
|
|
2021-09-02 10:11:45 +04:00
|
|
|
[
|
|
|
|
"import"
|
|
|
|
"package"
|
|
|
|
] @keyword.control.import
|
|
|
|
|
|
|
|
; Delimiters
|
|
|
|
|
|
|
|
[
|
|
|
|
":"
|
|
|
|
"."
|
|
|
|
","
|
|
|
|
";"
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
[
|
|
|
|
"("
|
|
|
|
")"
|
|
|
|
"["
|
|
|
|
"]"
|
|
|
|
"{"
|
|
|
|
"}"
|
|
|
|
] @punctuation.bracket
|
|
|
|
|
2021-04-09 12:42:49 +04:00
|
|
|
; Literals
|
|
|
|
|
|
|
|
[
|
|
|
|
(interpreted_string_literal)
|
|
|
|
(raw_string_literal)
|
|
|
|
(rune_literal)
|
|
|
|
] @string
|
|
|
|
|
2021-11-03 07:00:52 +04:00
|
|
|
(escape_sequence) @constant.character.escape
|
2021-04-09 12:42:49 +04:00
|
|
|
|
|
|
|
[
|
|
|
|
(int_literal)
|
|
|
|
(float_literal)
|
|
|
|
(imaginary_literal)
|
2021-11-03 07:00:52 +04:00
|
|
|
] @constant.numeric.integer
|
2021-04-09 12:42:49 +04:00
|
|
|
|
|
|
|
[
|
|
|
|
(true)
|
|
|
|
(false)
|
2021-09-02 10:11:45 +04:00
|
|
|
] @constant.builtin.boolean
|
|
|
|
|
|
|
|
(nil) @constant.builtin
|
2021-04-09 12:42:49 +04:00
|
|
|
|
|
|
|
(comment) @comment
|