mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -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,20 +26,19 @@
|
||||||
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
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -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]"))
|
||||||
|
|
@ -133,6 +132,12 @@
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
|
(string_literal) @string
|
||||||
|
|
||||||
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
|
(character_literal) @character
|
||||||
|
|
||||||
[
|
[
|
||||||
(hex_integer_literal)
|
(hex_integer_literal)
|
||||||
(decimal_integer_literal)
|
(decimal_integer_literal)
|
||||||
|
|
@ -145,43 +150,27 @@
|
||||||
(hex_floating_point_literal)
|
(hex_floating_point_literal)
|
||||||
] @float
|
] @float
|
||||||
|
|
||||||
(character_literal) @character
|
|
||||||
[(string_literal) (text_block)] @string
|
|
||||||
(null_literal) @constant.builtin
|
|
||||||
|
|
||||||
[
|
|
||||||
(line_comment)
|
|
||||||
(block_comment)
|
|
||||||
] @comment @spell
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
(false)
|
(false)
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
|
(null_literal) @constant.builtin
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"assert"
|
"assert"
|
||||||
"break"
|
|
||||||
"class"
|
"class"
|
||||||
"record"
|
"record"
|
||||||
"continue"
|
|
||||||
"default"
|
"default"
|
||||||
"enum"
|
"enum"
|
||||||
"exports"
|
|
||||||
"extends"
|
"extends"
|
||||||
"implements"
|
"implements"
|
||||||
"instanceof"
|
"instanceof"
|
||||||
"interface"
|
"interface"
|
||||||
"module"
|
|
||||||
"opens"
|
|
||||||
"package"
|
|
||||||
"permits"
|
"permits"
|
||||||
"provides"
|
|
||||||
"requires"
|
|
||||||
"to"
|
"to"
|
||||||
"uses"
|
|
||||||
"with"
|
"with"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
|
@ -231,18 +220,28 @@
|
||||||
|
|
||||||
(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
|
||||||
|
|
||||||
|
|
@ -253,14 +252,11 @@
|
||||||
","
|
","
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[ "{" "}" ] @punctuation.bracket
|
||||||
"["
|
|
||||||
"]"
|
[ "[" "]" ] @punctuation.bracket
|
||||||
"{"
|
|
||||||
"}"
|
[ "(" ")" ] @punctuation.bracket
|
||||||
"("
|
|
||||||
")"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
; Exceptions
|
; Exceptions
|
||||||
|
|
||||||
|
|
@ -273,5 +269,13 @@
|
||||||
] @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