mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 02:40:09 -04:00
feat(roc): add new parser tree-sitter-roc
This commit is contained in:
parent
1d1d92e94a
commit
905fedfa28
6 changed files with 246 additions and 0 deletions
|
|
@ -370,6 +370,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [pip requirements](https://github.com/ObserverOfTime/tree-sitter-requirements) (maintained by @ObserverOfTime)
|
- [x] [pip requirements](https://github.com/ObserverOfTime/tree-sitter-requirements) (maintained by @ObserverOfTime)
|
||||||
- [x] [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) (maintained by @bamonroe)
|
- [x] [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) (maintained by @bamonroe)
|
||||||
- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (maintained by @Hubro)
|
- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (maintained by @Hubro)
|
||||||
|
- [x] [roc](https://github.com/nat-418/tree-sitter-roc) (maintained by @nat-418)
|
||||||
- [x] [ron](https://github.com/amaanq/tree-sitter-ron) (maintained by @amaanq)
|
- [x] [ron](https://github.com/amaanq/tree-sitter-ron) (maintained by @amaanq)
|
||||||
- [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd)
|
- [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd)
|
||||||
- [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD)
|
- [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD)
|
||||||
|
|
|
||||||
|
|
@ -590,6 +590,9 @@
|
||||||
"robot": {
|
"robot": {
|
||||||
"revision": "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af"
|
"revision": "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af"
|
||||||
},
|
},
|
||||||
|
"roc": {
|
||||||
|
"revision": "14c66eeceb7db2d5c98616036d861863b273bab8"
|
||||||
|
},
|
||||||
"ron": {
|
"ron": {
|
||||||
"revision": "ce6086b2c9e8e71065b8129d6c2289c5f66d1879"
|
"revision": "ce6086b2c9e8e71065b8129d6c2289c5f66d1879"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1730,6 +1730,14 @@ list.robot = {
|
||||||
maintainers = { "@Hubro" },
|
maintainers = { "@Hubro" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.roc = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/nat-418/tree-sitter-roc",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
},
|
||||||
|
maintainers = { "@nat-418" },
|
||||||
|
}
|
||||||
|
|
||||||
list.ron = {
|
list.ron = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/amaanq/tree-sitter-ron",
|
url = "https://github.com/amaanq/tree-sitter-ron",
|
||||||
|
|
|
||||||
189
queries/roc/highlights.scm
Normal file
189
queries/roc/highlights.scm
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
;---Most generic types---
|
||||||
|
(module) @module
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
(concrete_type) @type
|
||||||
|
|
||||||
|
;---annotations----
|
||||||
|
(annotation_type_def
|
||||||
|
(annotation_pre_colon
|
||||||
|
(identifier) @type))
|
||||||
|
|
||||||
|
(annotation_type_def
|
||||||
|
(annotation_pre_colon
|
||||||
|
(identifier) @function)
|
||||||
|
(function_type))
|
||||||
|
|
||||||
|
;----decleration types----
|
||||||
|
(value_declaration
|
||||||
|
(decl_left
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @variable.parameter)))
|
||||||
|
|
||||||
|
;---records----
|
||||||
|
(field_name) @variable.member
|
||||||
|
|
||||||
|
(record_field_pattern
|
||||||
|
(_
|
||||||
|
(identifier) @variable))
|
||||||
|
|
||||||
|
;matches the second identifier and all subsequent ones
|
||||||
|
(field_access_expr
|
||||||
|
(identifier) @variable.member)
|
||||||
|
|
||||||
|
;----comments----
|
||||||
|
(line_comment) @comment @spell
|
||||||
|
|
||||||
|
(doc_comment) @comment.documentation @spell
|
||||||
|
|
||||||
|
;-----Punctuation----
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
(arrow)
|
||||||
|
(back_arrow)
|
||||||
|
(backslash)
|
||||||
|
","
|
||||||
|
":"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"|"
|
||||||
|
"&"
|
||||||
|
(operator)
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(wildcard_pattern) @constant.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"then"
|
||||||
|
"else"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
(implements)
|
||||||
|
(when)
|
||||||
|
(is)
|
||||||
|
"as"
|
||||||
|
(to)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
;----headers-----
|
||||||
|
(interface_header
|
||||||
|
(name) @type.definition)
|
||||||
|
|
||||||
|
(imports
|
||||||
|
(imports_entry
|
||||||
|
(module) @module))
|
||||||
|
|
||||||
|
(packages
|
||||||
|
(record_pattern
|
||||||
|
(record_field_pattern
|
||||||
|
(field_name) @module)))
|
||||||
|
|
||||||
|
(app_name) @string.special
|
||||||
|
|
||||||
|
(import_path) @string.special.path
|
||||||
|
|
||||||
|
[
|
||||||
|
"app"
|
||||||
|
"packages"
|
||||||
|
"provides"
|
||||||
|
"interface"
|
||||||
|
"exposes"
|
||||||
|
"expect"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
(import_as)
|
||||||
|
"imports"
|
||||||
|
] @keyword.import
|
||||||
|
|
||||||
|
(backpassing_expr
|
||||||
|
assignee: (identifier_pattern
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
(value_declaration
|
||||||
|
(decl_left
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @function))
|
||||||
|
(expr_body
|
||||||
|
(anon_fun_expr)))
|
||||||
|
|
||||||
|
;----tags----
|
||||||
|
(tags_type
|
||||||
|
(apply_type
|
||||||
|
(concrete_type) @constructor))
|
||||||
|
|
||||||
|
[
|
||||||
|
(tag)
|
||||||
|
(opaque_tag)
|
||||||
|
] @constructor
|
||||||
|
|
||||||
|
;-----builtins----
|
||||||
|
(variable_expr
|
||||||
|
(module) @module
|
||||||
|
(identifier) @boolean
|
||||||
|
(#any-of? @boolean "true" "false")
|
||||||
|
(#eq? @module "Bool"))
|
||||||
|
|
||||||
|
"dbg" @keyword.debug
|
||||||
|
|
||||||
|
;----function invocations ----
|
||||||
|
(function_call_expr
|
||||||
|
caller: (variable_expr
|
||||||
|
(identifier) @function.call))
|
||||||
|
|
||||||
|
(function_call_expr
|
||||||
|
caller: (field_access_expr
|
||||||
|
(identifier) @function.call .))
|
||||||
|
|
||||||
|
(bin_op_expr
|
||||||
|
(operator
|
||||||
|
"|>") @operator
|
||||||
|
(variable_expr
|
||||||
|
(identifier) @function))
|
||||||
|
|
||||||
|
;----function arguments----
|
||||||
|
(argument_patterns
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
(argument_patterns
|
||||||
|
(_
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @variable.parameter)))
|
||||||
|
|
||||||
|
(argument_patterns
|
||||||
|
(_
|
||||||
|
(_
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @variable.parameter))))
|
||||||
|
|
||||||
|
;-----consts-----
|
||||||
|
[
|
||||||
|
(int)
|
||||||
|
(uint)
|
||||||
|
(iint)
|
||||||
|
(xint)
|
||||||
|
(natural)
|
||||||
|
] @number
|
||||||
|
|
||||||
|
[
|
||||||
|
(decimal)
|
||||||
|
(float)
|
||||||
|
] @number.float
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
(char) @character
|
||||||
5
queries/roc/injections.scm
Normal file
5
queries/roc/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
([
|
||||||
|
(line_comment)
|
||||||
|
(doc_comment)
|
||||||
|
] @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
||||||
40
queries/roc/locals.scm
Normal file
40
queries/roc/locals.scm
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
(expr_body) @local.scope
|
||||||
|
|
||||||
|
(argument_patterns
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @local.definition))
|
||||||
|
|
||||||
|
; (argument_patterns(long_identifier)@local.definition)
|
||||||
|
(exposes_list
|
||||||
|
(ident) @local.reference)
|
||||||
|
|
||||||
|
(opaque_type_def
|
||||||
|
(apply_type
|
||||||
|
(concrete_type) @local.definition.type))
|
||||||
|
|
||||||
|
(alias_type_def
|
||||||
|
(apply_type
|
||||||
|
(concrete_type) @local.definition.type))
|
||||||
|
|
||||||
|
(value_declaration
|
||||||
|
(decl_left
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @local.definition.function))
|
||||||
|
(expr_body
|
||||||
|
(anon_fun_expr)))
|
||||||
|
|
||||||
|
(value_declaration
|
||||||
|
(decl_left
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @local.definition.var)))
|
||||||
|
|
||||||
|
(identifier_pattern
|
||||||
|
(identifier) @local.definition)
|
||||||
|
|
||||||
|
(exposes
|
||||||
|
(ident) @local.reference)
|
||||||
|
|
||||||
|
(identifier) @local.reference
|
||||||
|
|
||||||
|
(tag_expr
|
||||||
|
(tag)) @local.reference
|
||||||
Loading…
Add table
Add a link
Reference in a new issue