|
| 1 | +(identifier !type) @variable |
| 2 | +(comment) @comment |
| 3 | + |
| 4 | +; Preprocessor Statement |
| 5 | +; -------- |
| 6 | +(preprocessor_statement) @tag |
| 7 | +; (metadata name: (identifier) @type) @tag |
| 8 | + |
| 9 | +; MetaData |
| 10 | +; -------- |
| 11 | +(metadata) @tag |
| 12 | +(metadata name: (identifier) @type) @tag |
| 13 | + |
| 14 | +; Generic/Type Params |
| 15 | +; -------------- |
| 16 | +(type_params |
| 17 | + "<" @punctuation.bracket |
| 18 | + (type_param (identifier) @type) |
| 19 | + ">" @punctuation.bracket |
| 20 | +) |
| 21 | + |
| 22 | +; Declarations |
| 23 | +; ------------ |
| 24 | +(import_statement name: [ |
| 25 | + (identifier) @type |
| 26 | +; (_ (identifier) @type) |
| 27 | +; (_(_ (identifier) @type)) |
| 28 | +; (_(_(_ (identifier) @type))) |
| 29 | +; (_(_(_(_ (identifier) @type)))) |
| 30 | +; (_(_(_(_(_ (identifier) @type))))) |
| 31 | +]) |
| 32 | +(package_statement name: (identifier) @type) |
| 33 | + |
| 34 | +(class_declaration name: (identifier) @type.definition) |
| 35 | +(class_declaration super_class_name: (identifier) @type.definition) |
| 36 | +(class_declaration interface_name: (identifier) @type.definition) |
| 37 | +(interface_declaration name: (identifier) @type.definition) |
| 38 | +(interface_declaration interface_name: (identifier) @type.definition) |
| 39 | +(typedef_declaration name: (identifier) @type.definition) |
| 40 | + |
| 41 | +(function_declaration name: (identifier) @function) |
| 42 | +(function_arg name: (identifier) @variable.parameter) |
| 43 | + |
| 44 | +; Expressions |
| 45 | +; ----------- |
| 46 | +; (call_expression name: (identifier) @variable.parameter) |
| 47 | + |
| 48 | +; TODO: Figure out how to determined when "nested member call" is last ident. |
| 49 | +; apparently this is a known issue https://github.com/tree-sitter/tree-sitter/issues/880 |
| 50 | +(call_expression object: [ |
| 51 | + (identifier) @function |
| 52 | + (_ (identifier) @method .) |
| 53 | + (_(_ (identifier) @method .)) |
| 54 | + (_(_(_ (identifier) @method .))) |
| 55 | + (_(_(_(_ (identifier) @method .)))) |
| 56 | + (_(_(_(_(_ (identifier) @method .))))) |
| 57 | +]) |
| 58 | + |
| 59 | +; Literals |
| 60 | +; -------- |
| 61 | +[(keyword) (null)] @keyword |
| 62 | +; (type) @type |
| 63 | +(type (identifier) !built_in) @type |
| 64 | +(type built_in: (identifier)) @type.builtin |
| 65 | +[(integer) (float)] @number |
| 66 | +(string) @string |
| 67 | +(bool) @constant |
| 68 | +(operator) @operator |
| 69 | +(escape_sequence) @punctuation |
| 70 | + |
| 71 | +; Interpolation |
| 72 | +; ------------- |
| 73 | +(interpolation "$" @punctuation.special) |
| 74 | +(interpolation |
| 75 | + "${" @punctuation.special |
| 76 | + "}" @punctuation.special |
| 77 | +) @embedded |
| 78 | + |
| 79 | + |
| 80 | +; Tokens |
| 81 | +; ------ |
| 82 | + |
| 83 | +(":") @punctuation.special |
| 84 | +(pair [":" "=>"] @punctuation.special) |
| 85 | + |
| 86 | +[ |
| 87 | + "(" |
| 88 | + ")" |
| 89 | + "[" |
| 90 | + "]" |
| 91 | + "{" |
| 92 | + "}" |
| 93 | +] @punctuation.bracket |
| 94 | +; |
| 95 | +[ |
| 96 | +; ";" |
| 97 | +; "?." |
| 98 | +; "." |
| 99 | + "," |
| 100 | +] @punctuation.delimiter |
0 commit comments