Refactor (new syntax)

This commit is contained in:
Chinmay 2020-06-20 17:08:04 +05:30
parent 7372837300
commit 40cc924bf4
No known key found for this signature in database
GPG key ID: 16593543D199D510

View file

@ -2,22 +2,34 @@
; Methods ; Methods
(method_declaration [
name: (identifier) @method) (method_declaration
(method_declaration name: (identifier))
parameters: (formal_parameter) @parameter)
(method_invocation (method_invocation
name: (identifier) @method) name: (identifier))
] @method
[
(method_declaration
parameters: (formal_parameter))
(method_declaration
parameters: (formal_parameter))
] @parameter
(super) @function.builtin (super) @function.builtin
; Annotations ; Annotations
(annotation [
name: (identifier) @attribute) (annotation
(marker_annotation name: (identifier))
name: (identifier) @attribute) (marker_annotation
name: (identifier))
] @attribute
; Operators ; Operators
[ [
"@" "@"
"+" "+"
@ -47,12 +59,18 @@
; Types ; Types
(interface_declaration [
name: (identifier) @type) (interface_declaration
(class_declaration name: (identifier))
name: (identifier) @type) (class_declaration
(enum_declaration name: (identifier))
name: (identifier) @type) (enum_declaration
name: (identifier)
(constructor_declaration
name: (identifier))
(type_identifier)
] @type
((field_access ((field_access
object: (identifier) @type) object: (identifier) @type)
@ -61,15 +79,13 @@
scope: (identifier) @type) scope: (identifier) @type)
(#match? @type "^[A-Z]")) (#match? @type "^[A-Z]"))
(constructor_declaration [
name: (identifier) @type) (boolean_type)
(integral_type)
(type_identifier) @type (floating_point_type)
(boolean_type) @type.builtin (floating_point_type)
(integral_type) @type.builtin (void_type)
(floating_point_type) @type.builtin ] @type.builtin
(floating_point_type) @type.builtin
(void_type) @type.builtin
; Variables ; Variables
@ -77,16 +93,21 @@
(#match? @constant "^_*[A-Z][A-Z\d_]+")) (#match? @constant "^_*[A-Z][A-Z\d_]+"))
(identifier) @variable (identifier) @variable
(this) @variable.builtin (this) @variable.builtin
; Literals ; Literals
(hex_integer_literal) @number [
(decimal_integer_literal) @number (hex_integer_literal)
(octal_integer_literal) @number (decimal_integer_literal)
(decimal_floating_point_literal) @float (octal_integer_literal)
(hex_floating_point_literal) @float ] @number
[
(decimal_floating_point_literal)
(hex_floating_point_literal)
] @float
(character_literal) @character (character_literal) @character
(string_literal) @string (string_literal) @string
(null_literal) @constant.builtin (null_literal) @constant.builtin
@ -152,25 +173,29 @@
"case" "case"
] @conditional ] @conditional
; ;
[ [
"for" "for"
"while" "while"
] @repeat ] @repeat
; ; Includes
"import" @include "import" @include
; Punctuation ; Punctuation
";" @punctuation.delimiter [
"." @punctuation.delimiter ";"
"," @punctuation.delimiter "."
"[" @punctuation.bracket ","
"]" @punctuation.bracket ] @punctuation.delimiter
"{" @punctuation.bracket
"}" @punctuation.bracket [
"(" @punctuation.bracket "["
")" @punctuation.bracket "]"
"{"
"}"
"("
")"] @punctuation.bracket