nvim-treesitter/queries/smali/highlights.scm

219 lines
3.3 KiB
Scheme
Raw Normal View History

2023-01-08 01:56:27 -05:00
; Types
(class_identifier
(identifier) @type)
2023-01-08 01:56:27 -05:00
(primitive_type) @type.builtin
((class_identifier
. (identifier) @_first @type.builtin
(identifier) @type.builtin)
(#any-of? @_first "android" "dalvik" "java" "kotlinx"))
((class_identifier
. (identifier) @_first @type.builtin
. (identifier) @_second @type.builtin
(identifier) @type.builtin)
(#eq? @_first "com")
(#any-of? @_second "android" "google"))
2023-01-08 01:56:27 -05:00
; Methods
2023-02-20 08:10:43 -05:00
(method_definition
(method_signature (method_identifier) @method))
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
(expression
2023-01-08 01:56:27 -05:00
(opcode) @_invoke
2023-02-20 08:10:43 -05:00
(body
(full_method_signature
(method_signature (method_identifier) @method.call)))
2023-01-08 01:56:27 -05:00
(#lua-match? @_invoke "^invoke"))
2023-02-20 08:10:43 -05:00
(method_handle
(full_method_signature
(method_signature (method_identifier) @method.call)))
(custom_invoke
. (identifier) @method.call
2023-02-20 08:10:43 -05:00
(method_signature (method_identifier) @method.call))
(annotation_value
(body
(method_signature (method_identifier) @method.call)))
(annotation_value
(body
(full_method_signature
(method_signature (method_identifier) @method.call))))
(field_definition
(body
(method_signature (method_identifier) @method.call)))
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
(field_definition
(body
(full_method_signature
(method_signature (method_identifier) @method.call))))
2023-02-20 08:10:43 -05:00
((method_identifier) @constructor
2023-02-20 08:10:43 -05:00
(#any-of? @constructor "<init>" "<clinit>"))
2023-01-08 01:56:27 -05:00
"constructor" @constructor
2023-01-08 01:56:27 -05:00
; Fields
[
(field_identifier)
(annotation_key)
] @field
2023-01-08 01:56:27 -05:00
((field_identifier) @constant
(#lua-match? @constant "^[%u_]*$"))
2023-01-08 01:56:27 -05:00
; Variables
2023-02-20 08:10:43 -05:00
(variable) @variable.builtin
(local_directive
(identifier) @variable)
; Parameters
(parameter) @parameter.builtin
(param_identifier) @parameter
2023-01-08 01:56:27 -05:00
; Labels
2023-02-20 08:10:43 -05:00
[
(label)
(jmp_label)
] @label
2023-01-08 01:56:27 -05:00
; Operators
(opcode) @keyword.operator
((opcode) @keyword.return
2023-02-20 08:10:43 -05:00
(#lua-match? @keyword.return "^return"))
((opcode) @conditional
2023-04-21 04:06:20 -04:00
(#lua-match? @conditional "^if"))
((opcode) @conditional
(#lua-match? @conditional "^cmp"))
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
((opcode) @exception
(#lua-match? @exception "^throw"))
((opcode) @comment
(#eq? @comment "nop")) ; haha, anyone get it? ;)
2023-02-20 08:10:43 -05:00
[
"="
".."
] @operator
2023-01-08 01:56:27 -05:00
; Keywords
[
".class"
".super"
".implements"
".field"
2023-02-20 08:10:43 -05:00
".end field"
2023-01-08 01:56:27 -05:00
".annotation"
2023-02-20 08:10:43 -05:00
".end annotation"
2023-01-08 01:56:27 -05:00
".subannotation"
2023-02-20 08:10:43 -05:00
".end subannotation"
2023-01-08 01:56:27 -05:00
".param"
2023-02-20 08:10:43 -05:00
".end param"
".parameter"
".end parameter"
2023-01-08 01:56:27 -05:00
".line"
".locals"
2023-02-20 08:10:43 -05:00
".local"
".end local"
".restart local"
2023-01-08 01:56:27 -05:00
".registers"
".packed-switch"
".end packed-switch"
".sparse-switch"
".end sparse-switch"
".array-data"
".end array-data"
".enum"
2023-02-20 08:10:43 -05:00
(prologue_directive)
(epilogue_directive)
2023-01-08 01:56:27 -05:00
] @keyword
[
".source"
] @include
[
".method"
2023-02-20 08:10:43 -05:00
".end method"
] @keyword.function
[
".catch"
".catchall"
] @exception
2023-01-08 01:56:27 -05:00
; Literals
2023-02-20 08:10:43 -05:00
(string) @string
(source_directive (string "\"" _ @text.uri "\""))
2023-02-20 08:10:43 -05:00
(escape_sequence) @string.escape
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
(character) @character
2023-01-08 01:56:27 -05:00
"L" @character.special
2023-02-20 08:10:43 -05:00
(number) @number
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
[
(float)
(NaN)
(Infinity)
] @float
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
(boolean) @boolean
(null) @constant.builtin
2023-01-08 01:56:27 -05:00
; Misc
2023-02-20 08:10:43 -05:00
(annotation_visibility) @storageclass
2023-01-08 01:56:27 -05:00
(access_modifier) @type.qualifier
2023-01-08 01:56:27 -05:00
2023-02-20 08:10:43 -05:00
(array_type
"[" @punctuation.special)
2023-01-08 01:56:27 -05:00
["{" "}"] @punctuation.bracket
2023-02-20 08:10:43 -05:00
["(" ")"] @punctuation.bracket
[
"->"
","
":"
";"
2023-02-20 08:10:43 -05:00
"@"
"/"
2023-02-20 08:10:43 -05:00
] @punctuation.delimiter
2023-01-08 01:56:27 -05:00
(line_directive (number) @text.underline @text.literal)
2023-01-08 01:56:27 -05:00
; Comments
(comment) @comment @spell
(class_definition
(comment) @comment.documentation)
; Errors
(ERROR) @error