diff options
| author | Tomas Sandven <597206+Hubro@users.noreply.github.com> | 2023-08-17 06:27:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-17 00:27:51 -0400 |
| commit | 087166aae1e2098061eb51eb6e9745bedc7760f8 (patch) | |
| tree | 7e93e8856d465651c15a6a662deb71d759ab87b0 | |
| parent | feat(python): update parser & highlights (diff) | |
| download | nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.tar nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.tar.gz nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.tar.bz2 nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.tar.lz nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.tar.xz nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.tar.zst nvim-treesitter-087166aae1e2098061eb51eb6e9745bedc7760f8.zip | |
feat(robot): update parser, queries and maintainer
* Update tree-sitter-robot version and maintainer
* Improve query code style
* Update tree-sitter-robot revision
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | lockfile.json | 2 | ||||
| -rw-r--r-- | queries/robot/folds.scm | 5 | ||||
| -rw-r--r-- | queries/robot/highlights.scm | 64 | ||||
| -rw-r--r-- | queries/robot/indents.scm | 21 |
5 files changed, 78 insertions, 16 deletions
@@ -324,7 +324,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97) - [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] [robot](https://github.com/Hubro/tree-sitter-robot) (experimental, maintained by @ema2159) +- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (maintained by @Hubro) - [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) diff --git a/lockfile.json b/lockfile.json index 008c934a0..15c0298ec 100644 --- a/lockfile.json +++ b/lockfile.json @@ -453,7 +453,7 @@ "revision": "502c1126dc6777f09af5bef16e72a42f75bd081e" }, "robot": { - "revision": "f6f2eaf8bc711bcded4ede4e10859b06f73e191f" + "revision": "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af" }, "ron": { "revision": "ce6086b2c9e8e71065b8129d6c2289c5f66d1879" diff --git a/queries/robot/folds.scm b/queries/robot/folds.scm new file mode 100644 index 000000000..948f8a17d --- /dev/null +++ b/queries/robot/folds.scm @@ -0,0 +1,5 @@ +[ + (section) + (keyword_definition) + (test_case_definition) +] @fold diff --git a/queries/robot/highlights.scm b/queries/robot/highlights.scm index abff22c42..152526f70 100644 --- a/queries/robot/highlights.scm +++ b/queries/robot/highlights.scm @@ -1,21 +1,57 @@ -(argument (dictionary_variable) @string.special) -(argument (list_variable) @string.special) -(argument (scalar_variable) @string.special) -(argument (text_chunk) @string) +[ + (comment) + (extra_text) +] @comment -(keyword_invocation (keyword) @function) +[ + (section_header) + (setting_statement) + (keyword_setting) + (test_case_setting) +] @keyword -(test_case_definition (name) @property) - -(keyword_definition (body (keyword_setting) @keyword)) +(variable_definition (variable_name) @variable) (keyword_definition (name) @function) +(test_case_definition (name) @function) -(variable_definition (variable_name) @variable) +(keyword_invocation (keyword) @function.call) +(ellipses) @punctuation.delimiter -(setting_statement) @keyword +(text_chunk) @string +(inline_python_expression) @string.special +[ + (scalar_variable) + (list_variable) + (dictionary_variable) +] @variable -(extra_text) @comment -(section_header) @keyword +; Control structures -(ellipses) @punctuation.delimiter -(comment) @comment +[ + "FOR" + "IN" + "IN RANGE" + "IN ENUMERATE" + "IN ZIP" + (break_statement) + (continue_statement) +] @repeat +(for_statement "END" @repeat) + +"WHILE" @repeat +(while_statement "END" @repeat) + +[ + "IF" + "ELSE IF" +] @conditional +(if_statement "END" @conditional) +(if_statement (else_statement "ELSE" @conditional)) + +[ + "TRY" + "EXCEPT" + "FINALLY" +] @exception +(try_statement "END" @exception) +(try_statement (else_statement "ELSE" @exception)) diff --git a/queries/robot/indents.scm b/queries/robot/indents.scm new file mode 100644 index 000000000..ae34b83a2 --- /dev/null +++ b/queries/robot/indents.scm @@ -0,0 +1,21 @@ +(keyword_definition) @indent.begin +(test_case_definition) @indent.begin + +(for_statement) @indent.begin +(for_statement "END" @indent.branch) +(for_statement + right: (_ (arguments (continuation (ellipses) @indent.branch)))) + +(while_statement) @indent.begin +(while_statement "END" @indent.branch) + +(if_statement) @indent.begin +(if_statement (elseif_statement) @indent.branch) +(if_statement (else_statement) @indent.branch) +(if_statement "END" @indent.branch) + +(try_statement) @indent.begin +(try_statement (except_statement) @indent.branch) +(try_statement (finally_statement) @indent.branch) +(try_statement (else_statement) @indent.branch) +(try_statement "END" @indent.branch) |
