@@ -0,0 +1,216 @@
1+; Types
2+
3+(class_identifier
4+ (identifier) @type)
5+
6+(primitive_type) @type.builtin
7+
8+((class_identifier
9+ . (identifier) @_first @type.builtin
10+ (identifier) @type.builtin)
11+ (#match? @_first "^(android|dalvik|java|kotlinx)$"))
12+
13+((class_identifier
14+ . (identifier) @_first @type.builtin
15+ . (identifier) @_second @type.builtin
16+ (identifier) @type.builtin)
17+ (#eq? @_first "com")
18+ (#match? @_second "^(android|google)$"))
19+
20+; Methods
21+
22+(method_definition
23+ (method_signature (method_identifier) @function.method))
24+
25+(expression
26+ (opcode) @_invoke
27+ (body
28+ (full_method_signature
29+ (method_signature (method_identifier) @function.method)))
30+ (#match? @_invoke "^invoke"))
31+
32+(expression
33+ (opcode) @_field_access
34+ (body
35+ (field_identifier) @variable.other.member)
36+ (#match? @_field_access "^[is](get|put)-"))
37+
38+(method_handle
39+ (full_method_signature
40+ (method_signature (method_identifier) @function.method)))
41+
42+(custom_invoke
43+ . (identifier) @function.method
44+ (method_signature (method_identifier) @function.method))
45+
46+(annotation_value
47+ (body
48+ (method_signature (method_identifier) @function.method)))
49+
50+(annotation_value
51+ (body
52+ (full_method_signature
53+ (method_signature (method_identifier) @function.method))))
54+
55+(field_definition
56+ (body
57+ (method_signature (method_identifier) @function.method)))
58+
59+(field_definition
60+ (body
61+ (full_method_signature
62+ (method_signature (method_identifier) @function.method))))
63+
64+((method_identifier) @constructor
65+ (#match? @constructor "^(<init>|<clinit>)$"))
66+
67+"constructor" @constructor
68+
69+; Fields
70+
71+[
72+ (field_identifier)
73+ (annotation_key)
74+] @variable.other.member
75+
76+((field_identifier) @constant
77+ (#match? @constant "^[%u_]*$"))
78+
79+; Variables
80+
81+(variable) @variable.builtin
82+
83+(local_directive
84+ (identifier) @variable)
85+
86+; Parameters
87+
88+(parameter) @variable.parameter
89+(param_identifier) @variable.parameter
90+
91+; Labels
92+
93+[
94+ (label)
95+ (jmp_label)
96+] @label
97+
98+; Operators
99+
100+; (opcode) @keyword.operator
101+
102+((opcode) @keyword.control.return
103+ (#match? @keyword.control.return "^return"))
104+
105+((opcode) @keyword.control.conditional
106+ (#match? @keyword.control.conditional "^if"))
107+
108+((opcode) @keyword.control.conditional
109+ (#match? @keyword.control.conditional "^cmp"))
110+
111+((opcode) @keyword.control.exception
112+ (#match? @keyword.control.exception "^throw"))
113+
114+[
115+ "="
116+ ".."
117+] @operator
118+
119+; Keywords
120+
121+[
122+ ".class"
123+ ".super"
124+ ".implements"
125+ ".field"
126+ ".end field"
127+ ".annotation"
128+ ".end annotation"
129+ ".subannotation"
130+ ".end subannotation"
131+ ".param"
132+ ".end param"
133+ ".parameter"
134+ ".end parameter"
135+ ".local"
136+ ".end local"
137+ ".restart local"
138+ ".registers"
139+ ".packed-switch"
140+ ".end packed-switch"
141+ ".sparse-switch"
142+ ".end sparse-switch"
143+ ".array-data"
144+ ".end array-data"
145+ ".enum"
146+ (prologue_directive)
147+ (epilogue_directive)
148+] @keyword
149+
150+[
151+ ".source"
152+] @keyword.directive
153+
154+[
155+ ".method"
156+ ".end method"
157+] @keyword.function
158+
159+[
160+ ".catch"
161+ ".catchall"
162+] @keyword.control.exception
163+
164+; Literals
165+
166+(string) @string
167+(source_directive (string "\"" _ @string.special.url "\""))
168+(escape_sequence) @constant.character.escape
169+
170+(character) @constant.character
171+
172+"L" @punctuation
173+
174+(line_directive (number) @comment) @comment
175+(".locals" (number) @comment) @comment
176+
177+(number) @constant.numeric.integer
178+
179+[
180+ (float)
181+ (NaN)
182+ (Infinity)
183+] @constant.numeric.float
184+
185+(boolean) @constant.builtin.boolean
186+
187+(null) @constant.builtin
188+
189+; Misc
190+
191+(annotation_visibility) @keyword.storage.modifier
192+
193+(access_modifier) @keyword.storage.type
194+
195+(array_type
196+ "[" @punctuation.special)
197+
198+["{" "}"] @punctuation.bracket
199+
200+["(" ")"] @punctuation.bracket
201+
202+[
203+ "->"
204+ ","
205+ ":"
206+ ";"
207+ "@"
208+ "/"
209+] @punctuation.delimiter
210+
211+; Comments
212+
213+(comment) @comment
214+
215+(class_definition
216+ (comment) @comment.block.documentation)