nvim-treesitter/queries/r/highlights.scm

145 lines
1.6 KiB
Scheme
Raw Normal View History

2021-03-09 21:06:07 +02:00
; highlights.scm
; Literals
(integer) @number
2021-11-15 21:24:32 -03:00
(float) @float
2021-03-09 21:06:07 +02:00
(complex) @number
(string) @string
(string (escape_sequence) @string.escape)
2021-03-09 21:06:07 +02:00
2022-10-06 10:13:03 +02:00
(comment) @comment @spell
2021-03-09 21:06:07 +02:00
((program . (comment) @preproc)
2023-04-21 04:06:20 -04:00
(#lua-match? @preproc "^#!/"))
2021-03-09 21:06:07 +02:00
(identifier) @variable
2022-10-29 22:53:01 -03:00
((dollar (identifier) @variable.builtin)
(#eq? @variable.builtin "self"))
((dollar _ (identifier) @field))
; Parameters
(formal_parameters (identifier) @parameter)
2022-10-29 22:53:01 -03:00
2022-03-28 17:13:48 -03:00
(formal_parameters
(default_parameter name: (identifier) @parameter))
2022-10-29 22:53:01 -03:00
(default_argument name: (identifier) @parameter)
; Namespace
(namespace_get namespace: (identifier) @namespace)
(namespace_get_internal namespace: (identifier) @namespace)
2021-03-09 21:06:07 +02:00
; Operators
[
"="
"<-"
"<<-"
"->"
] @operator
(unary operator: [
"-"
"+"
"!"
"~"
2022-10-29 22:53:01 -03:00
"?"
2021-03-09 21:06:07 +02:00
] @operator)
(binary operator: [
"-"
"+"
"*"
"/"
"^"
"<"
">"
"<="
">="
"=="
"!="
"||"
"|"
"&&"
"&"
":"
"~"
] @operator)
[
"|>"
(special)
] @operator
2021-03-09 21:06:07 +02:00
(lambda_function "\\" @operator)
2021-03-09 21:06:07 +02:00
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
2022-11-29 13:54:07 -03:00
(dollar _ "$" @operator)
2021-11-15 21:24:32 -03:00
(subset2
"[[" @punctuation.bracket
"]]" @punctuation.bracket)
2021-03-09 21:06:07 +02:00
[
(dots)
(break)
(next)
] @keyword
2021-07-05 15:04:42 -05:00
2021-11-15 21:24:32 -03:00
[
(nan)
(na)
(null)
2022-10-29 23:09:50 -03:00
(inf)
2022-10-29 22:53:01 -03:00
] @constant.builtin
2021-11-15 21:24:32 -03:00
[
"if"
"else"
"switch"
2021-11-15 21:24:32 -03:00
] @conditional
[
"while"
"repeat"
"for"
2022-11-29 14:07:39 -03:00
"in"
2021-11-15 21:24:32 -03:00
] @repeat
[
(true)
(false)
] @boolean
2021-07-05 15:04:42 -05:00
"function" @keyword.function
2021-11-15 21:24:32 -03:00
2023-03-29 23:47:49 +02:00
; Functions/Methods
2022-10-29 22:53:01 -03:00
(call function: (identifier) @function.call)
2022-01-22 06:16:13 -03:00
2022-10-29 22:53:01 -03:00
(call
(namespace_get function: (identifier) @function.call))
2022-01-22 06:16:13 -03:00
2022-10-29 22:53:01 -03:00
(call
(namespace_get_internal function: (identifier) @function.call))
2022-01-22 06:16:13 -03:00
2022-10-29 22:53:01 -03:00
(call
function: ((dollar _ (identifier) @method.call)))
2022-01-22 06:16:13 -03:00
2021-11-15 21:24:32 -03:00
; Error
(ERROR) @error