diff options
| author | Amaan Qureshi <amaanq12@gmail.com> | 2023-02-28 00:16:21 -0500 |
|---|---|---|
| committer | Amaan Qureshi <amaanq12@gmail.com> | 2023-02-28 02:51:00 -0500 |
| commit | 316200f77d4261ebd4957b29fc6958f988e0964d (patch) | |
| tree | 9644cc98e094f354e7e3411819465948c678b4bb | |
| parent | fix(eex): map eelixir filetype to the eex parser (diff) | |
| download | nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.tar nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.tar.gz nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.tar.bz2 nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.tar.lz nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.tar.xz nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.tar.zst nvim-treesitter-316200f77d4261ebd4957b29fc6958f988e0964d.zip | |
feat: add matlab
| -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/matlab/folds.scm | 16 | ||||
| -rw-r--r-- | queries/matlab/highlights.scm | 107 | ||||
| -rw-r--r-- | queries/matlab/injections.scm | 1 |
6 files changed, 136 insertions, 0 deletions
@@ -264,6 +264,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [make](https://github.com/alemuller/tree-sitter-make) (maintained by @lewis6991) - [x] [markdown](https://github.com/MDeiml/tree-sitter-markdown) (experimental, maintained by @MDeiml) - [x] [markdown_inline](https://github.com/MDeiml/tree-sitter-markdown) (experimental, maintained by @MDeiml) +- [x] [matlab](https://github.com/mstanciu552/tree-sitter-matlab) (maintained by @amaanq) - [x] [menhir](https://github.com/Kerl13/tree-sitter-menhir) (maintained by @Kerl13) - [ ] [mermaid](https://github.com/monaqa/tree-sitter-mermaid) (experimental) - [x] [meson](https://github.com/Decodetalkers/tree-sitter-meson) (maintained by @Decodetalkers) diff --git a/lockfile.json b/lockfile.json index 410e06557..52002c5e8 100644 --- a/lockfile.json +++ b/lockfile.json @@ -272,6 +272,9 @@ "markdown_inline": { "revision": "7e7aa9a25ca9729db9fe22912f8f47bdb403a979" }, + "matlab": { + "revision": "2d5d3d5193718a86477d4335aba5b34e79147326" + }, "menhir": { "revision": "db7953acb0d5551f207373c81fa07a57d7b085cb" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b5bdeb820..2719194bc 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -888,6 +888,14 @@ list.markdown_inline = { experimental = true, } +list.matlab = { + install_info = { + url = "https://github.com/mstanciu552/tree-sitter-matlab", + files = { "src/parser.c" }, + }, + maintainers = { "@amaanq" }, +} + list.menhir = { install_info = { url = "https://github.com/Kerl13/tree-sitter-menhir", diff --git a/queries/matlab/folds.scm b/queries/matlab/folds.scm new file mode 100644 index 000000000..063a99b5a --- /dev/null +++ b/queries/matlab/folds.scm @@ -0,0 +1,16 @@ +[ + (function_definition) + + (if_statement) + + (for_statement) + (while_statement) + + (switch_statement) + (case_statement) + + (otherwise_statement) + + (try_statement) + (catch_statement) +] @fold diff --git a/queries/matlab/highlights.scm b/queries/matlab/highlights.scm new file mode 100644 index 000000000..bad9dbdf4 --- /dev/null +++ b/queries/matlab/highlights.scm @@ -0,0 +1,107 @@ +; Functions + +(function_definition + function_name: (identifier) @function + (end) @keyword.function) + +(parameter_list (identifier) @parameter) + +; Keywords + +((identifier) @keyword + (#eq? @keyword "end")) + +(function_keyword) @keyword.function + +[ + "return" +] @keyword.return + +; Conditionals + +[ + "if" + "elseif" + "else" + "switch" + "case" + "otherwise" +] @conditional + +(if_statement (end) @conditional) +(switch_statement (end) @conditional) + +; Repeats + +[ + "for" + "while" + "break" + "continue" +] @repeat + +(for_statement (end) @repeat) +(while_statement (end) @repeat) + +; Exceptions + +[ + "try" + "catch" +] @exception + +(try_statement (end) @exception) + +; Punctuation + +[ + "," + ";" + ":" +] @punctuation.delimiter + +[ "{" "}" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +; Operators + +[ + ">" + "<" + "==" + "<=" + ">=" + "=<" + "=>" + "~=" + "*" + ".*" + "/" + "\\" + "./" + "^" + ".^" + "+" + "=" + "&&" + "||" +] @operator + +; Literals + +(number) @number + +(string) @string + +[ "true" "false" ] @boolean + +; Comments + +(comment) @comment @spell + +; Errors + +(ERROR) @error diff --git a/queries/matlab/injections.scm b/queries/matlab/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/queries/matlab/injections.scm @@ -0,0 +1 @@ +(comment) @comment |
