feat: add RON

This commit is contained in:
Amaan Qureshi 2023-02-04 15:42:12 -05:00 committed by Stephan Seitz
parent 70af55b428
commit 720f75f988
8 changed files with 100 additions and 2 deletions

View file

@ -290,6 +290,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta)
- [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97)
- [x] [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) (maintained by @bamonroe)
- [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] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD)
- [x] [rust](https://github.com/tree-sitter/tree-sitter-rust) (maintained by @vigoux)

View file

@ -353,6 +353,9 @@
"rnoweb": {
"revision": "502c1126dc6777f09af5bef16e72a42f75bd081e"
},
"ron": {
"revision": "81e528eeb35518b8ef6f2761e91c0b10c76b4183"
},
"rst": {
"revision": "25e6328872ac3a764ba8b926aea12719741103f1"
},

View file

@ -424,7 +424,6 @@ list.func = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-func",
files = { "src/parser.c" },
branch = "master",
},
maintainers = { "@amaanq" },
}
@ -755,7 +754,6 @@ list.julia = {
list.kdl = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-kdl",
branch = "master",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@amaanq" },
@ -1128,6 +1126,14 @@ list.rnoweb = {
maintainers = { "@bamonroe" },
}
list.ron = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-ron",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@amaanq" },
}
list.rst = {
install_info = {
url = "https://github.com/stsewd/tree-sitter-rst",

7
queries/ron/folds.scm Normal file
View file

@ -0,0 +1,7 @@
[
(array)
(map)
(tuple)
(struct)
(block_comment)
] @fold

View file

@ -0,0 +1,53 @@
; Structs
;------------
(enum_variant) @constant
(struct_entry (identifier) @property)
(struct_entry (enum_variant (identifier) @constant))
(struct_name (identifier)) @type
(unit_struct) @type.builtin
; Literals
;------------
(string) @string
(boolean) @boolean
(integer) @number
(float) @float
(char) @character
; Comments
;------------
[
(line_comment)
(block_comment)
] @comment @spell
; Punctuation
;------------
["{" "}"] @punctuation.bracket
["(" ")"] @punctuation.bracket
["[" "]"] @punctuation.bracket
[
","
":"
] @punctuation.delimiter
[
"-"
] @operator
; Special
;------------
(escape_sequence) @string.escape
(ERROR) @error

12
queries/ron/indents.scm Normal file
View file

@ -0,0 +1,12 @@
[
(array)
(map)
(tuple)
(struct)
] @indent
[ "{" "}" ] @branch
[ "(" ")" ] @branch
[ "[" "]" ] @branch

View file

@ -0,0 +1,4 @@
[
(line_comment)
(block_comment)
] @comment

12
queries/ron/locals.scm Normal file
View file

@ -0,0 +1,12 @@
(source_file) @scope
(source_file (array) @scope)
(source_file (map) @scope)
(source_file (struct) @scope)
(source_file (tuple) @scope)
(identifier) @reference
(struct_entry (identifier) @definition.field)
(struct_entry (identifier) @definition.enum (enum_variant))
(struct (struct_name) @definition.type)