diff options
| author | Philipp Mildenberger <philipp@mildenberger.me> | 2023-02-20 17:55:06 +0100 |
|---|---|---|
| committer | Amaan Qureshi <amaanq12@gmail.com> | 2023-02-27 17:57:04 -0500 |
| commit | b9a7591b6c23c983256d034bedd5f509edc6351d (patch) | |
| tree | debcde3b46736b33e6f8744d5c381871bf8c7625 | |
| parent | move the catch uppercase query to the top to make it overridable, add back th... (diff) | |
| download | nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.tar nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.tar.gz nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.tar.bz2 nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.tar.lz nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.tar.xz nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.tar.zst nvim-treesitter-b9a7591b6c23c983256d034bedd5f509edc6351d.zip | |
feat: add yuck
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 9 | ||||
| -rw-r--r-- | queries/yuck/folds.scm | 9 | ||||
| -rw-r--r-- | queries/yuck/highlights.scm | 209 | ||||
| -rw-r--r-- | queries/yuck/indents.scm | 25 | ||||
| -rw-r--r-- | queries/yuck/injections.scm | 1 | ||||
| -rw-r--r-- | queries/yuck/locals.scm | 21 |
8 files changed, 278 insertions, 0 deletions
@@ -336,6 +336,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [wgsl_bevy](https://github.com/theHamsta/tree-sitter-wgsl-bevy) (maintained by @theHamsta) - [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd) - [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro) +- [x] [yuck](https://github.com/Philipp-M/tree-sitter-yuck) (maintained by @Philipp-M, @amaanq) - [x] [zig](https://github.com/maxxnino/tree-sitter-zig) (maintained by @maxxnino) <!--parserinfo--> diff --git a/lockfile.json b/lockfile.json index a3e3f471e..410e06557 100644 --- a/lockfile.json +++ b/lockfile.json @@ -488,6 +488,9 @@ "yang": { "revision": "2c0e6be8dd4dcb961c345fa35c309ad4f5bd3502" }, + "yuck": { + "revision": "607bf03cc78912cbaa85a3d373af21ddeaef5b41" + }, "zig": { "revision": "6b3f5788f38be900b45f5af5a753bf6a37d614b8" } diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index c570343bd..75efd7fca 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1551,6 +1551,15 @@ list.yang = { filetype = "yang", } +list.yuck = { + install_info = { + url = "https://github.com/Philipp-M/tree-sitter-yuck", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@Philipp-M", "@amaanq" }, + filetype = "yuck", +} + list.zig = { install_info = { url = "https://github.com/maxxnino/tree-sitter-zig", diff --git a/queries/yuck/folds.scm b/queries/yuck/folds.scm new file mode 100644 index 000000000..bad5a07c9 --- /dev/null +++ b/queries/yuck/folds.scm @@ -0,0 +1,9 @@ +[ + (ast_block) + (list) + (array) + (expr) + (json_array) + (json_object) + (parenthesized_expression) +] @fold diff --git a/queries/yuck/highlights.scm b/queries/yuck/highlights.scm new file mode 100644 index 000000000..8b2ca5814 --- /dev/null +++ b/queries/yuck/highlights.scm @@ -0,0 +1,209 @@ +; Tags + +(list + (symbol) @tag) + +; Includes + +((symbol) @include + (#match? @include "include")) + +; Keywords + +((symbol) @keyword + (#any-of? @keyword "defwindow" "defwidget" "defvar" "defpoll" "deflisten" "for" "geometry" "children" "struts")) + +; Functions + +(function_call + name: (ident) @function.call) + +; Variables + +(array + (symbol) @variable) + +(binary_expression + (simplexpr + (ident) @variable)) + +(unary_expression + (simplexpr + (ident) @variable)) + +(ternary_expression + (simplexpr + (ident) @variable)) + +(array + (symbol) @variable) + +(json_access + (simplexpr + (ident) @variable)) + +(json_safe_access + (simplexpr + (ident) @variable)) + +(json_array + (simplexpr + (ident) @variable)) + +(json_dot_access + (simplexpr + (ident) @variable)) + +(json_safe_dot_access + (simplexpr + (ident) @variable)) + +(json_object + (_) + ":" + (simplexpr + (ident) @variable)) + +; Properties & Fields + +(keyword) @property + +(json_access + (_) + "[" + (simplexpr + (ident) @property)) + +(json_safe_access + (_) + "?." + "[" + (simplexpr + (ident) @property)) + +(json_dot_access + (index) @property) + +(json_safe_dot_access + (index) @property) + +(json_object + (simplexpr + (ident) @field)) + +; Operators + +[ + "+" + "-" + "*" + "/" + "%" + "&&" + "||" + "==" + "!=" + "=~" + ">=" + "<=" + ">" + "<" + "?:" + "?." + "!" +] @operator + +(ternary_expression + ["?" ":"] @conditional.ternary) + +; Properties & Fields + +(keyword) @property + +(json_access + (_) + "[" + (simplexpr + (ident) @property)) + +(json_safe_access + (_) + "?." + "[" + (simplexpr + (ident) @property)) + +(json_dot_access + (index) @property) + +(json_safe_dot_access + (index) @property) + +(json_object + (simplexpr + (ident) @field)) + +; Operators + +[ + "+" + "-" + "*" + "/" + "%" + "||" + "&&" + "==" + "!=" + "=~" + ">" + "<" + ">=" + "<=" + "!" + "?." +] @operator + +(ternary_expression + ["?" ":"] @conditional.ternary) + +; Punctuation + +[ + ":" + "." + "," +] @punctuation.delimiter + +["{" "}" "[" "]" "(" ")"] @punctuation.bracket + +; Literals + +(number) @number + +(float) @float + +(boolean) @boolean + +; Strings + +[ (string_fragment) "\"" "'" "`" ] @string + +(string_interpolation + "${" @punctuation.special + "}" @punctuation.special) + +(escape_sequence) @string.escape + +; Comments + +(comment) @comment @spell + +; Other stuff that has not been catched by the previous queries yet + +(ident) @variable +(index) @property + +; Errors + +(ERROR) @error diff --git a/queries/yuck/indents.scm b/queries/yuck/indents.scm new file mode 100644 index 000000000..b53ba75dd --- /dev/null +++ b/queries/yuck/indents.scm @@ -0,0 +1,25 @@ +[ + (ast_block) + (array) + (expr) + (json_array) + (json_object) + (parenthesized_expression) +] @indent + +; TODO: can't get this to work, goal is to indent at the property ":" prefix +; ((list (identifier) (property)) @aligned_indent +; (#set! "delimiter" ":")) + +[")" "}" "]"] @indent_end + +[ "{" "}" ] @branch + +[ "(" ")" ] @branch + +[ "[" "]" ] @branch + +[ + (ERROR) + (comment) +] @auto diff --git a/queries/yuck/injections.scm b/queries/yuck/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/queries/yuck/injections.scm @@ -0,0 +1 @@ +(comment) @comment diff --git a/queries/yuck/locals.scm b/queries/yuck/locals.scm new file mode 100644 index 000000000..677281b0b --- /dev/null +++ b/queries/yuck/locals.scm @@ -0,0 +1,21 @@ +[ + (ast_block) + (list) + (array) + (expr) + (json_array) + (json_object) + (parenthesized_expression) +] @scope + +(symbol) @reference + +(keyword) @definition.field + +(json_object + (simplexpr + (ident) @definition.field)) + +(ast_block + (symbol) + (ident) @definition.type) |
