nvim-treesitter/queries/java/highlights.scm

209 lines
2.1 KiB
Scheme
Raw Normal View History

2020-06-17 18:01:29 +05:30
; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com)
2020-06-11 22:31:45 +05:30
; Methods
2020-06-23 11:48:23 +05:30
2020-06-20 17:12:07 +05:30
(method_declaration
2020-06-23 19:34:40 +05:30
name: (identifier) @method)
2020-06-20 17:12:07 +05:30
(method_invocation
2020-06-23 19:34:40 +05:30
name: (identifier) @method)
2020-06-23 11:48:23 +05:30
2020-06-23 19:00:35 +05:30
(super) @function.builtin
2020-06-20 17:08:04 +05:30
2020-06-23 19:00:35 +05:30
; Parameters
2020-06-21 23:34:28 +05:30
(formal_parameter
2020-06-23 19:34:40 +05:30
name: (identifier) @parameter)
2020-06-20 17:08:04 +05:30
2020-06-23 19:00:35 +05:30
(inferred_parameters (identifier) @parameter)
2020-06-11 22:31:45 +05:30
; Annotations
2020-06-23 11:48:23 +05:30
2020-06-20 17:12:07 +05:30
(annotation
2020-06-23 19:34:40 +05:30
name: (identifier) @attribute)
2020-06-20 17:12:07 +05:30
(marker_annotation
2020-06-23 19:34:40 +05:30
name: (identifier) @attribute)
2020-06-23 11:48:23 +05:30
2020-06-11 22:31:45 +05:30
2020-06-15 22:45:56 +05:30
; Operators
2020-06-20 17:08:04 +05:30
2020-06-15 22:45:56 +05:30
[
"@"
"+"
"++"
"-"
"--"
"&"
"&&"
"|"
"||"
"!="
"=="
"*"
"/"
"%"
"<"
"<="
">"
">="
"="
"-="
"+="
"*="
"/="
"%="
"->"
2020-06-28 15:28:22 +05:30
"^"
2020-06-28 16:51:03 +05:30
"^="
2020-06-28 17:00:00 +05:30
"&="
"|="
2020-06-28 16:51:03 +05:30
"~"
2020-06-28 15:28:22 +05:30
">>"
">>>"
"<<"
2020-06-29 17:22:19 +05:30
"::"
2020-06-15 22:45:56 +05:30
] @operator
2020-06-11 22:31:45 +05:30
; Types
2020-06-20 17:12:07 +05:30
(interface_declaration
2020-06-23 19:34:40 +05:30
name: (identifier) @type)
2020-06-20 17:12:07 +05:30
(class_declaration
2020-06-23 19:34:40 +05:30
name: (identifier) @type)
2020-06-20 17:12:07 +05:30
(enum_declaration
2020-06-23 19:34:40 +05:30
name: (identifier) @type)
2020-06-20 17:12:07 +05:30
(constructor_declaration
2020-06-23 19:34:40 +05:30
name: (identifier) @type)
(type_identifier) @type
2020-06-23 11:48:23 +05:30
2020-06-20 17:08:04 +05:30
2020-06-11 22:31:45 +05:30
((field_access
object: (identifier) @type)
2020-06-23 19:34:40 +05:30
(#match? @type "^[A-Z]"))
2020-06-11 22:31:45 +05:30
((scoped_identifier
scope: (identifier) @type)
2020-06-23 19:34:40 +05:30
(#match? @type "^[A-Z]"))
2020-06-11 22:31:45 +05:30
2020-06-20 17:08:04 +05:30
[
(boolean_type)
(integral_type)
2020-06-28 16:20:21 +05:30
(floating_point_type)
(void_type)
2020-06-20 17:08:04 +05:30
] @type.builtin
2020-06-11 22:31:45 +05:30
; Variables
((identifier) @constant
2020-06-23 19:34:40 +05:30
(#match? @constant "^_*[A-Z][A-Z\d_]+"))
2020-06-11 22:31:45 +05:30
2020-06-28 18:07:37 +05:30
2020-06-11 22:31:45 +05:30
; Literals
2020-06-20 17:08:04 +05:30
[
2020-06-20 17:12:07 +05:30
(hex_integer_literal)
(decimal_integer_literal)
(octal_integer_literal)
2020-06-20 17:08:04 +05:30
] @number
[
2020-06-20 17:12:07 +05:30
(decimal_floating_point_literal)
(hex_floating_point_literal)
2020-06-20 17:08:04 +05:30
] @float
2020-06-15 23:23:17 +05:30
(character_literal) @character
2020-06-11 22:31:45 +05:30
(string_literal) @string
(null_literal) @constant.builtin
(comment) @comment
[
(true)
(false)
] @boolean
; Keywords
[
"abstract"
"assert"
"break"
"catch"
"class"
"continue"
"default"
"enum"
"exports"
"extends"
"final"
"finally"
"implements"
"instanceof"
"interface"
"module"
"native"
"new"
"open"
"opens"
"package"
"private"
"protected"
"provides"
"public"
"requires"
"return"
"static"
"strictfp"
"synchronized"
"throw"
"throws"
"to"
"transient"
"transitive"
"try"
"uses"
"volatile"
"with"
] @keyword
; Conditionals
[
"if"
"else"
"switch"
"case"
] @conditional
2020-06-20 17:08:04 +05:30
;
2020-06-11 22:31:45 +05:30
[
"for"
"while"
"do"
2020-06-11 22:31:45 +05:30
] @repeat
2020-06-20 17:08:04 +05:30
; Includes
2020-06-11 22:31:45 +05:30
"import" @include
"package" @include
2020-06-11 22:31:45 +05:30
; Punctuation
2020-06-20 17:08:04 +05:30
[
2020-06-20 17:12:07 +05:30
";"
"."
","
2020-06-20 17:08:04 +05:30
] @punctuation.delimiter
[
"["
"]"
"{"
"}"
"("
2020-06-20 17:12:07 +05:30
")"
] @punctuation.bracket