nvim-treesitter/queries/java/highlights.scm

195 lines
1.9 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 11:48:23 +05:30
name: (identifier) @method)
2020-06-20 17:12:07 +05:30
(method_invocation
2020-06-23 11:48:23 +05:30
name: (identifier) @method)
2020-06-20 17:08:04 +05:30
2020-06-21 23:34:28 +05:30
(formal_parameter
2020-06-21 23:36:02 +05:30
name: (identifier) @parameter)
2020-06-20 17:08:04 +05:30
2020-06-11 22:31:45 +05:30
(super) @function.builtin
; Annotations
2020-06-23 11:48:23 +05:30
2020-06-20 17:12:07 +05:30
(annotation
2020-06-23 11:48:23 +05:30
name: (identifier) @attribute)
2020-06-20 17:12:07 +05:30
(marker_annotation
2020-06-23 11:48:23 +05:30
name: (identifier) @attribute)
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-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 11:48:23 +05:30
name: (identifier) @type)
2020-06-20 17:12:07 +05:30
(class_declaration
2020-06-23 11:48:23 +05:30
name: (identifier) @type)
2020-06-20 17:12:07 +05:30
(enum_declaration
name: (identifier) @type)
2020-06-20 17:12:07 +05:30
(constructor_declaration
2020-06-23 11:48:23 +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)
(#match? @type "^[A-Z]"))
((scoped_identifier
scope: (identifier) @type)
(#match? @type "^[A-Z]"))
2020-06-20 17:08:04 +05:30
[
(boolean_type)
(integral_type)
] @type.builtin
2020-06-11 22:31:45 +05:30
; Variables
((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\d_]+"))
(identifier) @variable
(this) @variable.builtin
; 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"
"do"
"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"
] @repeat
2020-06-20 17:08:04 +05:30
; Includes
2020-06-11 22:31:45 +05:30
"import" @include
; 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