From 720f75f9881cae820cecde23fc2f07affacf2826 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 4 Feb 2023 15:42:12 -0500 Subject: feat: add RON --- README.md | 1 + lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 10 ++++++-- queries/ron/folds.scm | 7 ++++++ queries/ron/highlights.scm | 53 +++++++++++++++++++++++++++++++++++++++++ queries/ron/indents.scm | 12 ++++++++++ queries/ron/injections.scm | 4 ++++ queries/ron/locals.scm | 12 ++++++++++ 8 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 queries/ron/folds.scm create mode 100644 queries/ron/highlights.scm create mode 100644 queries/ron/indents.scm create mode 100644 queries/ron/injections.scm create mode 100644 queries/ron/locals.scm diff --git a/README.md b/README.md index 874cdffb4..94dd25b5f 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/lockfile.json b/lockfile.json index 8e0088af2..8529912b2 100644 --- a/lockfile.json +++ b/lockfile.json @@ -353,6 +353,9 @@ "rnoweb": { "revision": "502c1126dc6777f09af5bef16e72a42f75bd081e" }, + "ron": { + "revision": "81e528eeb35518b8ef6f2761e91c0b10c76b4183" + }, "rst": { "revision": "25e6328872ac3a764ba8b926aea12719741103f1" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 024bdefce..33196bd8d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -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", diff --git a/queries/ron/folds.scm b/queries/ron/folds.scm new file mode 100644 index 000000000..ae79583ea --- /dev/null +++ b/queries/ron/folds.scm @@ -0,0 +1,7 @@ +[ + (array) + (map) + (tuple) + (struct) + (block_comment) +] @fold diff --git a/queries/ron/highlights.scm b/queries/ron/highlights.scm new file mode 100644 index 000000000..869264305 --- /dev/null +++ b/queries/ron/highlights.scm @@ -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 diff --git a/queries/ron/indents.scm b/queries/ron/indents.scm new file mode 100644 index 000000000..84701a7e9 --- /dev/null +++ b/queries/ron/indents.scm @@ -0,0 +1,12 @@ +[ + (array) + (map) + (tuple) + (struct) +] @indent + +[ "{" "}" ] @branch + +[ "(" ")" ] @branch + +[ "[" "]" ] @branch diff --git a/queries/ron/injections.scm b/queries/ron/injections.scm new file mode 100644 index 000000000..e48ce9af3 --- /dev/null +++ b/queries/ron/injections.scm @@ -0,0 +1,4 @@ +[ + (line_comment) + (block_comment) +] @comment diff --git a/queries/ron/locals.scm b/queries/ron/locals.scm new file mode 100644 index 000000000..de90d35fd --- /dev/null +++ b/queries/ron/locals.scm @@ -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) -- cgit v1.2.3-70-g09d2