mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 16:30:02 -04:00
Add support for R language.
This commit is contained in:
parent
df81a91ba9
commit
773ec8eefc
3 changed files with 105 additions and 0 deletions
|
|
@ -474,6 +474,14 @@ list.svelte = {
|
||||||
maintainers = { "@elianiva" },
|
maintainers = { "@elianiva" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.r = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/r-lib/tree-sitter-r",
|
||||||
|
files = { "src/parser.c" }
|
||||||
|
},
|
||||||
|
maintainers = { "@jimhester" },
|
||||||
|
}
|
||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
list = list
|
list = list
|
||||||
}
|
}
|
||||||
|
|
|
||||||
86
queries/r/highlights.scm
Executable file
86
queries/r/highlights.scm
Executable file
|
|
@ -0,0 +1,86 @@
|
||||||
|
; highlights.scm
|
||||||
|
|
||||||
|
(call function: (identifier) @function)
|
||||||
|
(namespace_get function: (identifier) @function.method)
|
||||||
|
(namespace_get_internal function: (identifier) @function.method)
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
|
||||||
|
(integer) @number
|
||||||
|
|
||||||
|
(float) @number
|
||||||
|
|
||||||
|
(complex) @number
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
(formal_parameters (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"<-"
|
||||||
|
"<<-"
|
||||||
|
"->"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(unary operator: [
|
||||||
|
"-"
|
||||||
|
"+"
|
||||||
|
"!"
|
||||||
|
"~"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(binary operator: [
|
||||||
|
"-"
|
||||||
|
"+"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
"^"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
"<="
|
||||||
|
">="
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
"||"
|
||||||
|
"|"
|
||||||
|
"&&"
|
||||||
|
"&"
|
||||||
|
":"
|
||||||
|
"~"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(special) @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"while"
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
"function"
|
||||||
|
"repeat"
|
||||||
|
"for"
|
||||||
|
"in"
|
||||||
|
(dots)
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
(break)
|
||||||
|
(next)
|
||||||
|
(inf)
|
||||||
|
(nan)
|
||||||
|
(na)
|
||||||
|
(null)
|
||||||
|
] @keyword
|
||||||
11
queries/r/locals.scm
Executable file
11
queries/r/locals.scm
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
; locals.scm
|
||||||
|
|
||||||
|
(function_definition) @local.scope
|
||||||
|
|
||||||
|
(formal_parameters (identifier) @local.definition)
|
||||||
|
|
||||||
|
(left_assignment name: (identifier) @local.definition)
|
||||||
|
(equals_assignment name: (identifier) @local.definition)
|
||||||
|
(right_assignment name: (identifier) @local.definition)
|
||||||
|
|
||||||
|
(identifier) @local.reference
|
||||||
Loading…
Add table
Add a link
Reference in a new issue