diff options
| author | echasnovski <evgeni.chasnovski@gmail.com> | 2021-03-09 21:06:07 +0200 |
|---|---|---|
| committer | Kiyan <yazdani.kiyan@protonmail.com> | 2021-03-16 18:52:43 +0100 |
| commit | 773ec8eefc6509dcde1b67f0913e879634dbccf2 (patch) | |
| tree | fc33d024982b4bd6707b6cc465d6f4e64f817b6c | |
| parent | go: add builtin functions (diff) | |
| download | nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.tar nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.tar.gz nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.tar.bz2 nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.tar.lz nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.tar.xz nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.tar.zst nvim-treesitter-773ec8eefc6509dcde1b67f0913e879634dbccf2.zip | |
Add support for R language.
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rwxr-xr-x | queries/r/highlights.scm | 86 | ||||
| -rwxr-xr-x | queries/r/locals.scm | 11 |
3 files changed, 105 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a1727fc10..2c6022175 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -474,6 +474,14 @@ list.svelte = { maintainers = { "@elianiva" }, } +list.r = { + install_info = { + url = "https://github.com/r-lib/tree-sitter-r", + files = { "src/parser.c" } + }, + maintainers = { "@jimhester" }, +} + local M = { list = list } diff --git a/queries/r/highlights.scm b/queries/r/highlights.scm new file mode 100755 index 000000000..11f355e83 --- /dev/null +++ b/queries/r/highlights.scm @@ -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 diff --git a/queries/r/locals.scm b/queries/r/locals.scm new file mode 100755 index 000000000..be6cc6379 --- /dev/null +++ b/queries/r/locals.scm @@ -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 |
