diff options
| author | belltoy <belltoy@gmail.com> | 2024-07-28 13:15:43 +0800 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-07-30 22:08:38 +0200 |
| commit | 9f8c99e980f55e72148a95a0fb2e260c95f6341b (patch) | |
| tree | 075e7efc659474c3f5792fece5b1124fd849eb4b | |
| parent | bot(lockfile): update d, just, kotlin, wit (diff) | |
| download | nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.tar nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.tar.gz nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.tar.bz2 nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.tar.lz nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.tar.xz nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.tar.zst nvim-treesitter-9f8c99e980f55e72148a95a0fb2e260c95f6341b.zip | |
feat(vrl): Add vrl parser and queries
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/vrl/folds.scm | 6 | ||||
| -rw-r--r-- | queries/vrl/highlights.scm | 108 | ||||
| -rw-r--r-- | queries/vrl/indents.scm | 24 | ||||
| -rw-r--r-- | queries/vrl/injections.scm | 6 | ||||
| -rw-r--r-- | queries/vrl/locals.scm | 16 |
8 files changed, 172 insertions, 0 deletions
@@ -451,6 +451,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [vhs](https://github.com/charmbracelet/tree-sitter-vhs) (maintained by @caarlos0) - [x] [vim](https://github.com/neovim/tree-sitter-vim) (maintained by @clason) - [x] [vimdoc](https://github.com/neovim/tree-sitter-vimdoc) (maintained by @clason) +- [x] [vrl](https://github.com/belltoy/tree-sitter-vrl) (maintained by @belltoy) - [x] [vue](https://github.com/tree-sitter-grammars/tree-sitter-vue) (maintained by @WhyNotHugo, @lucario387) - [x] [wgsl](https://github.com/szebniok/tree-sitter-wgsl) (maintained by @szebniok) - [x] [wgsl_bevy](https://github.com/theHamsta/tree-sitter-wgsl-bevy) (maintained by @theHamsta) diff --git a/lockfile.json b/lockfile.json index 30771ce96..18be9e2f4 100644 --- a/lockfile.json +++ b/lockfile.json @@ -833,6 +833,9 @@ "vimdoc": { "revision": "2249c44ecd3f5cf22da3dcccfb74f816ddb29245" }, + "vrl": { + "revision": "274b3ce63f72aa8ffea18e7fc280d3062d28f0ba" + }, "vue": { "revision": "22bdfa6c9fc0f5ffa44c6e938ec46869ac8a99ff" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ad6068d02..969c75fea 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2398,6 +2398,14 @@ list.vimdoc = { maintainers = { "@clason" }, } +list.vrl = { + install_info = { + url = "https://github.com/belltoy/tree-sitter-vrl", + files = { "src/parser.c" }, + }, + maintainers = { "@belltoy" }, +} + list.vue = { install_info = { url = "https://github.com/tree-sitter-grammars/tree-sitter-vue", diff --git a/queries/vrl/folds.scm b/queries/vrl/folds.scm new file mode 100644 index 000000000..6c6d587de --- /dev/null +++ b/queries/vrl/folds.scm @@ -0,0 +1,6 @@ +[ + (block) + (object) + (array) + (arguments) +] @fold diff --git a/queries/vrl/highlights.scm b/queries/vrl/highlights.scm new file mode 100644 index 000000000..f74d6dd55 --- /dev/null +++ b/queries/vrl/highlights.scm @@ -0,0 +1,108 @@ +(comment) @comment @spell + +(null) @constant.builtin + +(timestamp) @constant + +(closure_variables + (ident) @variable.parameter) + +(integer) @number + +(float) @number.float + +[ + (string) + (raw_string) +] @string + +[ + (raw_string_escape_sequence) + (escape_sequence) + (regex_escape_sequence) +] @string.escape + +(string_template + "{{" @punctuation.special + (_) + "}}" @punctuation.special) + +(regex) @string.regexp + +(boolean) @boolean + +(ident) @variable + +(noop) @variable.builtin + +(function_call + (ident) @function.call) + +; VRL queries +(query + [ + (event) + (metadata) + ] @variable.builtin) + +(query + (path + [ + (field) @variable + (string) @string + (index) @number + "." @punctuation.delimiter + ])) + +"return" @keyword.return + +"abort" @keyword.exception + +[ + "if" + "else" +] @keyword.conditional + +[ + "=" + "==" + "!=" + "|=" + ">" + ">=" + "<" + "<=" + "+" + "-" + "*" + "/" + "&&" + "||" + "??" + "|" + "!" +] @operator + +[ + "->" + ":" + ";" + "," +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(closure_variables + "|" @punctuation.bracket) + +(function_call + (ident) @keyword.exception + "!" + (#any-of? @keyword.exception "assert" "assert_eq")) diff --git a/queries/vrl/indents.scm b/queries/vrl/indents.scm new file mode 100644 index 000000000..1fc1249e0 --- /dev/null +++ b/queries/vrl/indents.scm @@ -0,0 +1,24 @@ +[ + (block) + (object) + (array) + (arguments) +] @indent.begin + +(block + "}" @indent.end) + +(object + "}" @indent.end) + +(array + "]" @indent.end) + +(arguments + ")" @indent.end) + +[ + ")" + "]" + "}" +] @indent.branch diff --git a/queries/vrl/injections.scm b/queries/vrl/injections.scm new file mode 100644 index 000000000..5aaf9bcd2 --- /dev/null +++ b/queries/vrl/injections.scm @@ -0,0 +1,6 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((regex) @injection.content + (#offset! @injection.content 0 2 0 -1) + (#set! injection.language "regex")) diff --git a/queries/vrl/locals.scm b/queries/vrl/locals.scm new file mode 100644 index 000000000..786da98c5 --- /dev/null +++ b/queries/vrl/locals.scm @@ -0,0 +1,16 @@ +(closure_variables + (ident) @local.definition.parameter) + +[ + (ident) + (metadata) +] @local.reference + +(query + (event) @local.reference) + +[ + (block) + (closure) + (if_statement) +] @local.scope |
