| 1 | ; Function calls |
| 2 | |
| 3 | (call_expression |
| 4 | function: (identifier) @function) |
| 5 | |
| 6 | (call_expression |
| 7 | function: (identifier) @function.builtin |
| 8 | (#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$")) |
| 9 | |
| 10 | (call_expression |
| 11 | function: (selector_expression |
| 12 | field: (field_identifier) @function.method)) |
| 13 | |
| 14 | ; Function definitions |
| 15 | |
| 16 | (function_declaration |
| 17 | name: (identifier) @function) |
| 18 | |
| 19 | (method_declaration |
| 20 | name: (field_identifier) @function.method) |
| 21 | (method_elem |
| 22 | name: (field_identifier) @function.method) |
| 23 | |
| 24 | ; Identifiers |
| 25 | (keyed_element |
| 26 | . |
| 27 | (literal_element |
| 28 | (identifier) @variable.member)) |
| 29 | |
| 30 | (type_identifier) @type |
| 31 | (field_identifier) @variable.member |
| 32 | (identifier) @variable |
| 33 | (package_identifier) @namespace |
| 34 | |
| 35 | ; Operators |
| 36 | |
| 37 | [ |
| 38 | "--" |
| 39 | "-" |
| 40 | "-=" |
| 41 | ":=" |
| 42 | "!" |
| 43 | "!=" |
| 44 | "..." |
| 45 | "*" |
| 46 | "*" |
| 47 | "*=" |
| 48 | "/" |
| 49 | "/=" |
| 50 | "&" |
| 51 | "&&" |
| 52 | "&=" |
| 53 | "%" |
| 54 | "%=" |
| 55 | "^" |
| 56 | "^=" |
| 57 | "+" |
| 58 | "++" |
| 59 | "+=" |
| 60 | "<-" |
| 61 | "<" |
| 62 | "<<" |
| 63 | "<<=" |
| 64 | "<=" |
| 65 | "=" |
| 66 | "==" |
| 67 | ">" |
| 68 | ">=" |
| 69 | ">>" |
| 70 | ">>=" |
| 71 | "|" |
| 72 | "|=" |
| 73 | "||" |
| 74 | "~" |
| 75 | ] @operator |
| 76 | |
| 77 | ; Keywords |
| 78 | |
| 79 | [ |
| 80 | "break" |
| 81 | "case" |
| 82 | "chan" |
| 83 | "const" |
| 84 | "continue" |
| 85 | "default" |
| 86 | "defer" |
| 87 | "else" |
| 88 | "fallthrough" |
| 89 | "for" |
| 90 | "func" |
| 91 | "go" |
| 92 | "goto" |
| 93 | "if" |
| 94 | "import" |
| 95 | "interface" |
| 96 | "map" |
| 97 | "package" |
| 98 | "range" |
| 99 | "return" |
| 100 | "select" |
| 101 | "struct" |
| 102 | "switch" |
| 103 | "type" |
| 104 | "var" |
| 105 | ] @keyword |
| 106 | |
| 107 | ; Literals |
| 108 | |
| 109 | [ |
| 110 | (interpreted_string_literal) |
| 111 | (raw_string_literal) |
| 112 | (rune_literal) |
| 113 | ] @string |
| 114 | |
| 115 | (escape_sequence) @string.escape |
| 116 | |
| 117 | [ |
| 118 | (int_literal) |
| 119 | (float_literal) |
| 120 | (imaginary_literal) |
| 121 | ] @number |
| 122 | |
| 123 | (const_spec |
| 124 | name: (identifier) @constant) |
| 125 | |
| 126 | [ |
| 127 | (true) |
| 128 | (false) |
| 129 | ] @boolean |
| 130 | |
| 131 | [ |
| 132 | (nil) |
| 133 | (iota) |
| 134 | ] @constant.builtin |
| 135 | |
| 136 | (comment) @comment |