1; Taken from https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/rbs/highlights.scm
2; Use directive
3(use_clause
4 [
5 (type_name)
6 (simple_type_name)
7 ] @type)
8
9; Builtin constants and Keywords
10[
11 "true"
12 "false"
13] @boolean
14
15"nil" @constant.builtin
16
17[
18 "use"
19 "as"
20 "module"
21 "def"
22 "attr_reader"
23 "attr_writer"
24 "attr_accessor"
25 "end"
26 "alias"
27] @keyword
28
29[
30 "interface"
31 "type"
32 "class"
33] @keyword.type
34
35(class_decl
36 "end" @keyword.type)
37
38(interface_decl
39 "end" @keyword.type)
40
41"def" @keyword.function
42
43; Members of declaration
44[
45 "include"
46 "extend"
47 "prepend"
48] @function.method
49
50(visibility) @keyword.modifier
51
52(comment) @comment
53
54(method_member
55 (method_name
56 [
57 (identifier)
58 (constant)
59 (operator)
60 (setter)
61 ] @function.method))
62
63[
64 (ivar_name)
65 (cvar_name)
66] @variable.member
67
68(alias_member
69 (method_name) @function)
70
71(class_name
72 (constant) @type)
73
74(module_name
75 (constant) @type)
76
77(interface_name
78 (interface) @type)
79
80(alias_name
81 (identifier) @type)
82
83(type_variable) @constant
84
85(namespace
86 (constant) @module)
87
88(builtin_type) @type.builtin
89
90(const_name
91 (constant) @constant)
92
93(global_name) @variable
94
95; Standard Arguments
96(parameter
97 (var_name) @variable.parameter)
98
99; Keyword Arguments
100(keyword) @variable.parameter
101
102; Self
103(self) @variable.builtin
104
105; Literal
106(type
107 (symbol_literal) @string.special.symbol)
108
109(type
110 (string_literal
111 (escape_sequence) @string.escape))
112
113(type
114 (string_literal) @string)
115
116(type
117 (integer_literal) @number)
118
119; Operators
120[
121 "="
122 "->"
123 "<"
124 "**"
125 "*"
126 "&"
127 "|"
128 "^"
129] @operator
130
131; Punctuation
132[
133 "("
134 ")"
135 "["
136 "]"
137 "{"
138 "}"
139] @punctuation.bracket
140
141[
142 ","
143 "."
144] @punctuation.delimiter