From e1f2bb2fcfba4bfcf341b8c52cc059ed61018558 Mon Sep 17 00:00:00 2001 From: Amaan Q Date: Sun, 8 Jan 2023 01:56:27 -0500 Subject: feat: add smali query --- queries/smali/highlights.scm | 113 +++++++++++++++++++++++++++++++++++++++++++ queries/smali/injections.scm | 1 + 2 files changed, 114 insertions(+) create mode 100644 queries/smali/highlights.scm create mode 100644 queries/smali/injections.scm diff --git a/queries/smali/highlights.scm b/queries/smali/highlights.scm new file mode 100644 index 000000000..71e4220d9 --- /dev/null +++ b/queries/smali/highlights.scm @@ -0,0 +1,113 @@ +; Types + +(class_identifier) @type + +(primitive_type) @type.builtin + +(array_type + "[" @punctuation.bracket) + +; Methods + +(method_declaration + (method_identifier) @method) + +(statement + (opcode) @_invoke + (full_method_identifier + (method_identifier) @method.call) + (#lua-match? @_invoke "^invoke")) + +(method_identifier + "(" @constructor + ")" @constructor) + +(method_identifier + "(" @constructor + ")" @constructor) + +; Fields + +(field_identifier) @field + +; Parameters + +(parameter) @parameter + +; Variables + +(variable) @variable + +; Labels + +(label) @label + +; Operators + +(opcode) @keyword.operator + +((opcode) @keyword.return + (#lua-match? @keyword.return "^return")) + +"=" @operator + +; Keywords + +[ + ".class" + ".super" + ".source" + ".implements" + ".field" + ".method" + ".annotation" + ".subannotation" + ".param" + ".line" + ".locals" + ".registers" + ".catch" + ".catchall" + ".packed-switch" + ".end packed-switch" + ".sparse-switch" + ".end sparse-switch" + ".array-data" + ".end array-data" + ".enum" +] @keyword + +[ + (end_field) + (end_method) + (end_annotation) + (end_subannotation) + (end_param) +] @keyword + +; Literals + +(string_literal) @string + +(number_literal) @number + +(boolean_literal) @boolean + +;; unsupported +; (character_literal) @character + +(null_literal) @constant.builtin + +; Misc + +(annotation_visibility) @attribute + +(access_modifiers) @type.qualifier + +["{" "}"] @punctuation.bracket + +"->" @punctuation.delimiter + +; Comments + +(comment) @comment @spell diff --git a/queries/smali/injections.scm b/queries/smali/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/queries/smali/injections.scm @@ -0,0 +1 @@ +(comment) @comment -- cgit v1.2.3-70-g09d2