mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add matlab
This commit is contained in:
parent
f0617c31f4
commit
316200f77d
6 changed files with 136 additions and 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)
|
||||
|
|
|
|||
|
|
@ -272,6 +272,9 @@
|
|||
"markdown_inline": {
|
||||
"revision": "7e7aa9a25ca9729db9fe22912f8f47bdb403a979"
|
||||
},
|
||||
"matlab": {
|
||||
"revision": "2d5d3d5193718a86477d4335aba5b34e79147326"
|
||||
},
|
||||
"menhir": {
|
||||
"revision": "db7953acb0d5551f207373c81fa07a57d7b085cb"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
16
queries/matlab/folds.scm
Normal file
16
queries/matlab/folds.scm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[
|
||||
(function_definition)
|
||||
|
||||
(if_statement)
|
||||
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
|
||||
(switch_statement)
|
||||
(case_statement)
|
||||
|
||||
(otherwise_statement)
|
||||
|
||||
(try_statement)
|
||||
(catch_statement)
|
||||
] @fold
|
||||
107
queries/matlab/highlights.scm
Normal file
107
queries/matlab/highlights.scm
Normal file
|
|
@ -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
|
||||
1
queries/matlab/injections.scm
Normal file
1
queries/matlab/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment) @comment
|
||||
Loading…
Add table
Add a link
Reference in a new issue