mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 17:00:09 -04:00
feat(java): distinguish escape sequences, move certain keywords to more appropriate places
This commit is contained in:
parent
1641c4f3b4
commit
7dfaa60a85
4 changed files with 137 additions and 132 deletions
|
|
@ -204,7 +204,7 @@
|
||||||
"revision": "1a0ce072ebf3afac7d5603d9a95bb7c9a6709b44"
|
"revision": "1a0ce072ebf3afac7d5603d9a95bb7c9a6709b44"
|
||||||
},
|
},
|
||||||
"java": {
|
"java": {
|
||||||
"revision": "dd597f13eb9bab0c1bccc9aec390e8e6ebf9e0a6"
|
"revision": "3c24aa9365985830421a3a7b6791b415961ea770"
|
||||||
},
|
},
|
||||||
"javascript": {
|
"javascript": {
|
||||||
"revision": "266455e22fc54f0add4dd2404ebe307d4d65deae"
|
"revision": "266455e22fc54f0add4dd2404ebe307d4d65deae"
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,10 @@
|
||||||
(super) @function.builtin
|
(super) @function.builtin
|
||||||
|
|
||||||
; Parameters
|
; Parameters
|
||||||
|
|
||||||
(formal_parameter
|
(formal_parameter
|
||||||
name: (identifier) @parameter)
|
name: (identifier) @parameter)
|
||||||
|
|
||||||
(catch_formal_parameter
|
(catch_formal_parameter
|
||||||
name: (identifier) @parameter)
|
name: (identifier) @parameter)
|
||||||
|
|
||||||
|
|
@ -24,59 +26,58 @@
|
||||||
name: (identifier) @parameter)) ; int... foo
|
name: (identifier) @parameter)) ; int... foo
|
||||||
|
|
||||||
;; Lambda parameter
|
;; Lambda parameter
|
||||||
|
|
||||||
(inferred_parameters (identifier) @parameter) ; (x,y) -> ...
|
(inferred_parameters (identifier) @parameter) ; (x,y) -> ...
|
||||||
|
|
||||||
(lambda_expression
|
(lambda_expression
|
||||||
parameters: (identifier) @parameter) ; x -> ...
|
parameters: (identifier) @parameter) ; x -> ...
|
||||||
|
|
||||||
|
|
||||||
; Annotations
|
; Annotations
|
||||||
|
|
||||||
|
|
||||||
(annotation
|
(annotation
|
||||||
name: (identifier) @attribute)
|
name: (identifier) @attribute)
|
||||||
(marker_annotation
|
(marker_annotation
|
||||||
name: (identifier) @attribute)
|
name: (identifier) @attribute)
|
||||||
|
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
"@"
|
"@"
|
||||||
"+"
|
"+"
|
||||||
":"
|
":"
|
||||||
"++"
|
"++"
|
||||||
"-"
|
"-"
|
||||||
"--"
|
"--"
|
||||||
"&"
|
"&"
|
||||||
"&&"
|
"&&"
|
||||||
"|"
|
"|"
|
||||||
"||"
|
"||"
|
||||||
"!"
|
"!"
|
||||||
"!="
|
"!="
|
||||||
"=="
|
"=="
|
||||||
"*"
|
"*"
|
||||||
"/"
|
"/"
|
||||||
"%"
|
"%"
|
||||||
"<"
|
"<"
|
||||||
"<="
|
"<="
|
||||||
">"
|
">"
|
||||||
">="
|
">="
|
||||||
"="
|
"="
|
||||||
"-="
|
"-="
|
||||||
"+="
|
"+="
|
||||||
"*="
|
"*="
|
||||||
"/="
|
"/="
|
||||||
"%="
|
"%="
|
||||||
"->"
|
"->"
|
||||||
"^"
|
"^"
|
||||||
"^="
|
"^="
|
||||||
"&="
|
"&="
|
||||||
"|="
|
"|="
|
||||||
"~"
|
"~"
|
||||||
">>"
|
">>"
|
||||||
">>>"
|
">>>"
|
||||||
"<<"
|
"<<"
|
||||||
"::"
|
"::"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
@ -99,8 +100,6 @@
|
||||||
. (identifier) @type)
|
. (identifier) @type)
|
||||||
(#lua-match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
((field_access
|
((field_access
|
||||||
object: (identifier) @type)
|
object: (identifier) @type)
|
||||||
(#lua-match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
@ -118,10 +117,10 @@
|
||||||
field: (identifier) @field)
|
field: (identifier) @field)
|
||||||
|
|
||||||
[
|
[
|
||||||
(boolean_type)
|
(boolean_type)
|
||||||
(integral_type)
|
(integral_type)
|
||||||
(floating_point_type)
|
(floating_point_type)
|
||||||
(void_type)
|
(void_type)
|
||||||
] @type.builtin
|
] @type.builtin
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
@ -133,145 +132,150 @@
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
|
(string_literal) @string
|
||||||
|
|
||||||
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
|
(character_literal) @character
|
||||||
|
|
||||||
[
|
[
|
||||||
(hex_integer_literal)
|
(hex_integer_literal)
|
||||||
(decimal_integer_literal)
|
(decimal_integer_literal)
|
||||||
(octal_integer_literal)
|
(octal_integer_literal)
|
||||||
(binary_integer_literal)
|
(binary_integer_literal)
|
||||||
] @number
|
] @number
|
||||||
|
|
||||||
[
|
[
|
||||||
(decimal_floating_point_literal)
|
(decimal_floating_point_literal)
|
||||||
(hex_floating_point_literal)
|
(hex_floating_point_literal)
|
||||||
] @float
|
] @float
|
||||||
|
|
||||||
(character_literal) @character
|
|
||||||
[(string_literal) (text_block)] @string
|
|
||||||
(null_literal) @constant.builtin
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(line_comment)
|
(true)
|
||||||
(block_comment)
|
(false)
|
||||||
] @comment @spell
|
|
||||||
|
|
||||||
[
|
|
||||||
(true)
|
|
||||||
(false)
|
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
|
(null_literal) @constant.builtin
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"assert"
|
"assert"
|
||||||
"break"
|
"class"
|
||||||
"class"
|
"record"
|
||||||
"record"
|
"default"
|
||||||
"continue"
|
"enum"
|
||||||
"default"
|
"extends"
|
||||||
"enum"
|
"implements"
|
||||||
"exports"
|
"instanceof"
|
||||||
"extends"
|
"interface"
|
||||||
"implements"
|
"permits"
|
||||||
"instanceof"
|
"to"
|
||||||
"interface"
|
"with"
|
||||||
"module"
|
|
||||||
"opens"
|
|
||||||
"package"
|
|
||||||
"permits"
|
|
||||||
"provides"
|
|
||||||
"requires"
|
|
||||||
"to"
|
|
||||||
"uses"
|
|
||||||
"with"
|
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
(synchronized_statement
|
(synchronized_statement
|
||||||
"synchronized" @keyword)
|
"synchronized" @keyword)
|
||||||
|
|
||||||
[
|
[
|
||||||
"abstract"
|
"abstract"
|
||||||
"final"
|
"final"
|
||||||
"native"
|
"native"
|
||||||
"non-sealed"
|
"non-sealed"
|
||||||
"open"
|
"open"
|
||||||
"private"
|
"private"
|
||||||
"protected"
|
"protected"
|
||||||
"public"
|
"public"
|
||||||
"sealed"
|
"sealed"
|
||||||
"static"
|
"static"
|
||||||
"strictfp"
|
"strictfp"
|
||||||
"transitive"
|
"transitive"
|
||||||
] @type.qualifier
|
] @type.qualifier
|
||||||
|
|
||||||
(modifiers
|
(modifiers
|
||||||
"synchronized" @type.qualifier)
|
"synchronized" @type.qualifier)
|
||||||
|
|
||||||
[
|
[
|
||||||
"transient"
|
"transient"
|
||||||
"volatile"
|
"volatile"
|
||||||
] @storageclass
|
] @storageclass
|
||||||
|
|
||||||
[
|
[
|
||||||
"return"
|
"return"
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword.return
|
] @keyword.return
|
||||||
|
|
||||||
[
|
[
|
||||||
"new"
|
"new"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
; Conditionals
|
; Conditionals
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"else"
|
"else"
|
||||||
"switch"
|
"switch"
|
||||||
"case"
|
"case"
|
||||||
] @conditional
|
] @conditional
|
||||||
|
|
||||||
(ternary_expression ["?" ":"] @conditional.ternary)
|
(ternary_expression ["?" ":"] @conditional.ternary)
|
||||||
|
|
||||||
;
|
; Loops
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
"while"
|
"while"
|
||||||
"do"
|
"do"
|
||||||
|
"continue"
|
||||||
|
"break"
|
||||||
] @repeat
|
] @repeat
|
||||||
|
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
"import" @include
|
[
|
||||||
"package" @include
|
"exports"
|
||||||
|
"import"
|
||||||
|
"module"
|
||||||
|
"opens"
|
||||||
|
"package"
|
||||||
|
"provides"
|
||||||
|
"requires"
|
||||||
|
"uses"
|
||||||
|
] @include
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
";"
|
";"
|
||||||
"."
|
"."
|
||||||
"..."
|
"..."
|
||||||
","
|
","
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[ "{" "}" ] @punctuation.bracket
|
||||||
"["
|
|
||||||
"]"
|
[ "[" "]" ] @punctuation.bracket
|
||||||
"{"
|
|
||||||
"}"
|
[ "(" ")" ] @punctuation.bracket
|
||||||
"("
|
|
||||||
")"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
; Exceptions
|
; Exceptions
|
||||||
|
|
||||||
[
|
[
|
||||||
"throw"
|
"throw"
|
||||||
"throws"
|
"throws"
|
||||||
"finally"
|
"finally"
|
||||||
"try"
|
"try"
|
||||||
"catch"
|
"catch"
|
||||||
] @exception
|
] @exception
|
||||||
|
|
||||||
; Labels
|
; Labels
|
||||||
|
|
||||||
(labeled_statement
|
(labeled_statement
|
||||||
(identifier) @label)
|
(identifier) @label)
|
||||||
|
|
||||||
|
; Comments
|
||||||
|
|
||||||
|
[
|
||||||
|
(line_comment)
|
||||||
|
(block_comment)
|
||||||
|
] @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@
|
||||||
"]"
|
"]"
|
||||||
] @branch
|
] @branch
|
||||||
|
|
||||||
[
|
"}" @indent_end
|
||||||
"}"
|
|
||||||
] @indent_end
|
|
||||||
|
|
||||||
(line_comment) @ignore
|
(line_comment) @ignore
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,4 @@
|
||||||
[(block_comment) (line_comment)] @comment
|
[
|
||||||
|
(block_comment)
|
||||||
|
(line_comment)
|
||||||
|
] @comment
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue