feat(smali): update queries from upstream parser

This commit is contained in:
Amaan Qureshi 2023-04-24 19:10:49 -04:00
parent 1280315db1
commit 9f157094cd
3 changed files with 40 additions and 10 deletions

View file

@ -426,7 +426,7 @@
"revision": "07547525cdf4627343dca5891f1743ae45e879bb" "revision": "07547525cdf4627343dca5891f1743ae45e879bb"
}, },
"smali": { "smali": {
"revision": "b002dceb9b91a6d6de45479ab4b2e9596ebbaaf3" "revision": "9bf8aa671a233ae2d2c6e9512c7144ce121b1fb6"
}, },
"smithy": { "smithy": {
"revision": "cf8c7eb9faf7c7049839585eac19c94af231e6a0" "revision": "cf8c7eb9faf7c7049839585eac19c94af231e6a0"

View file

@ -1269,7 +1269,7 @@ list.slint = {
list.smali = { list.smali = {
install_info = { install_info = {
url = "https://git.sr.ht/~yotam/tree-sitter-smali", url = "https://git.sr.ht/~yotam/tree-sitter-smali",
files = { "src/parser.c" }, files = { "src/parser.c", "src/scanner.c" },
}, },
maintainers = { "@amaanq" }, maintainers = { "@amaanq" },
} }

View file

@ -1,11 +1,21 @@
; Types ; Types
(class_identifier) @type (class_identifier
(identifier) @type)
(primitive_type) @type.builtin (primitive_type) @type.builtin
((class_identifier) @type.builtin ((class_identifier
(#match? @type.builtin "^L(android|com/android|dalvik|java|kotlinx)/")) . (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"))
; Methods ; Methods
@ -48,6 +58,8 @@
((method_identifier) @constructor ((method_identifier) @constructor
(#any-of? @constructor "<init>" "<clinit>")) (#any-of? @constructor "<init>" "<clinit>"))
"constructor" @constructor
; Fields ; Fields
[ [
@ -55,6 +67,9 @@
(annotation_key) (annotation_key)
] @field ] @field
((field_identifier) @constant
(#lua-match? @constant "^[%u_]*$"))
; Variables ; Variables
(variable) @variable.builtin (variable) @variable.builtin
@ -90,6 +105,9 @@
((opcode) @exception ((opcode) @exception
(#lua-match? @exception "^throw")) (#lua-match? @exception "^throw"))
((opcode) @comment
(#eq? @comment "nop")) ; haha, anyone get it? ;)
[ [
"=" "="
".." ".."
@ -100,7 +118,6 @@
[ [
".class" ".class"
".super" ".super"
".source"
".implements" ".implements"
".field" ".field"
".end field" ".end field"
@ -118,8 +135,6 @@
".end local" ".end local"
".restart local" ".restart local"
".registers" ".registers"
".catch"
".catchall"
".packed-switch" ".packed-switch"
".end packed-switch" ".end packed-switch"
".sparse-switch" ".sparse-switch"
@ -131,11 +146,20 @@
(epilogue_directive) (epilogue_directive)
] @keyword ] @keyword
[
".source"
] @include
[ [
".method" ".method"
".end method" ".end method"
] @keyword.function ] @keyword.function
[
".catch"
".catchall"
] @exception
; Literals ; Literals
(string) @string (string) @string
@ -144,6 +168,8 @@
(character) @character (character) @character
"L" @character.special
(number) @number (number) @number
[ [
@ -160,7 +186,7 @@
(annotation_visibility) @storageclass (annotation_visibility) @storageclass
(access_modifiers) @type.qualifier (access_modifier) @type.qualifier
(array_type (array_type
"[" @punctuation.special) "[" @punctuation.special)
@ -171,11 +197,15 @@
[ [
"->" "->"
":"
"," ","
":"
";"
"@" "@"
"/"
] @punctuation.delimiter ] @punctuation.delimiter
(line_directive (number) @text.underline @text.literal)
; Comments ; Comments
(comment) @comment @spell (comment) @comment @spell