From 40cc924bf423192ff813cb423a14e397cf4fed07 Mon Sep 17 00:00:00 2001 From: Chinmay Date: Sat, 20 Jun 2020 17:08:04 +0530 Subject: [PATCH] Refactor (new syntax) --- queries/java/highlights.scm | 109 ++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 42 deletions(-) diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index 24e771df5..e7db0746d 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -2,22 +2,34 @@ ; Methods -(method_declaration - name: (identifier) @method) -(method_declaration - parameters: (formal_parameter) @parameter) -(method_invocation - name: (identifier) @method) +[ + (method_declaration + name: (identifier)) + + (method_invocation + name: (identifier)) +] @method + +[ + (method_declaration + parameters: (formal_parameter)) + (method_declaration + parameters: (formal_parameter)) +] @parameter + (super) @function.builtin ; Annotations -(annotation - name: (identifier) @attribute) -(marker_annotation - name: (identifier) @attribute) +[ + (annotation + name: (identifier)) + (marker_annotation + name: (identifier)) +] @attribute ; Operators + [ "@" "+" @@ -47,12 +59,18 @@ ; Types -(interface_declaration - name: (identifier) @type) -(class_declaration - name: (identifier) @type) -(enum_declaration - name: (identifier) @type) +[ + (interface_declaration + name: (identifier)) + (class_declaration + name: (identifier)) + (enum_declaration + name: (identifier) + (constructor_declaration + name: (identifier)) + (type_identifier) +] @type + ((field_access object: (identifier) @type) @@ -61,15 +79,13 @@ scope: (identifier) @type) (#match? @type "^[A-Z]")) -(constructor_declaration - name: (identifier) @type) - -(type_identifier) @type -(boolean_type) @type.builtin -(integral_type) @type.builtin -(floating_point_type) @type.builtin -(floating_point_type) @type.builtin -(void_type) @type.builtin +[ +(boolean_type) +(integral_type) +(floating_point_type) +(floating_point_type) +(void_type) +] @type.builtin ; Variables @@ -77,16 +93,21 @@ (#match? @constant "^_*[A-Z][A-Z\d_]+")) (identifier) @variable - (this) @variable.builtin ; Literals -(hex_integer_literal) @number -(decimal_integer_literal) @number -(octal_integer_literal) @number -(decimal_floating_point_literal) @float -(hex_floating_point_literal) @float +[ + (hex_integer_literal) + (decimal_integer_literal) + (octal_integer_literal) +] @number + +[ + (decimal_floating_point_literal) + (hex_floating_point_literal) +] @float + (character_literal) @character (string_literal) @string (null_literal) @constant.builtin @@ -152,25 +173,29 @@ "case" ] @conditional -; +; [ "for" "while" ] @repeat -; +; Includes "import" @include ; Punctuation -";" @punctuation.delimiter -"." @punctuation.delimiter -"," @punctuation.delimiter -"[" @punctuation.bracket -"]" @punctuation.bracket -"{" @punctuation.bracket -"}" @punctuation.bracket -"(" @punctuation.bracket -")" @punctuation.bracket +[ + ";" + "." + "," +] @punctuation.delimiter + +[ +"[" +"]" +"{" +"}" +"(" +")"] @punctuation.bracket