diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/matlab | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/matlab')
| -rw-r--r-- | runtime/queries/matlab/folds.scm | 13 | ||||
| -rw-r--r-- | runtime/queries/matlab/highlights.scm | 216 | ||||
| -rw-r--r-- | runtime/queries/matlab/indents.scm | 40 | ||||
| -rw-r--r-- | runtime/queries/matlab/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/matlab/locals.scm | 33 |
5 files changed, 304 insertions, 0 deletions
diff --git a/runtime/queries/matlab/folds.scm b/runtime/queries/matlab/folds.scm new file mode 100644 index 000000000..83008b3d7 --- /dev/null +++ b/runtime/queries/matlab/folds.scm @@ -0,0 +1,13 @@ +[ + (if_statement) + (for_statement) + (while_statement) + (switch_statement) + (try_statement) + (function_definition) + (class_definition) + (enumeration) + (events) + (methods) + (properties) +] @fold diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm new file mode 100644 index 000000000..d2ab6053e --- /dev/null +++ b/runtime/queries/matlab/highlights.scm @@ -0,0 +1,216 @@ +; Includes +((command_name) @keyword.import + (#eq? @keyword.import "import")) + +; Keywords +[ + "arguments" + "end" + "events" + "global" + "methods" + "persistent" + "properties" +] @keyword + +"enumeration" @keyword.type + +(class_definition + [ + "classdef" + "end" + ] @keyword.type) + +; Conditionals +(if_statement + [ + "if" + "end" + ] @keyword.conditional) + +(elseif_clause + "elseif" @keyword.conditional) + +(else_clause + "else" @keyword.conditional) + +(switch_statement + [ + "switch" + "end" + ] @keyword.conditional) + +(case_clause + "case" @keyword.conditional) + +(otherwise_clause + "otherwise" @keyword.conditional) + +(break_statement) @keyword.conditional + +; Repeats +(for_statement + [ + "for" + "parfor" + "end" + ] @keyword.repeat) + +(while_statement + [ + "while" + "end" + ] @keyword.repeat) + +(continue_statement) @keyword.repeat + +; Exceptions +(try_statement + [ + "try" + "end" + ] @keyword.exception) + +(catch_clause + "catch" @keyword.exception) + +; Variables +(identifier) @variable + +; Constants +(events + (identifier) @constant) + +(attribute + (identifier) @constant) + +"~" @constant.builtin + +; Fields/Properties +(field_expression + field: (identifier) @variable.member) + +(superclass + "." + (identifier) @variable.member) + +(property_name + "." + (identifier) @variable.member) + +(property + name: (identifier) @variable.member) + +; Types +(class_definition + name: (identifier) @type) + +(attributes + (identifier) @constant) + +(enum + . + (identifier) @type) + +((identifier) @type + (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$")) + +; Functions +(function_definition + "function" @keyword.function + name: (identifier) @function + [ + "end" + "endfunction" + ]? @keyword.function) + +(function_signature + name: (identifier) @function) + +(function_call + name: (identifier) @function.call) + +(handle_operator + (identifier) @function) + +(validation_functions + (identifier) @function) + +(command + (command_name) @function.call) + +(command_argument) @variable.parameter + +(return_statement) @keyword.return + +; Parameters +(function_arguments + (identifier) @variable.parameter) + +; Punctuation +[ + ";" + "," + "." +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; Operators +[ + "+" + ".+" + "-" + ".*" + "*" + ".*" + "/" + "./" + "\\" + ".\\" + "^" + ".^" + "'" + ".'" + "|" + "&" + "?" + "@" + "<" + "<=" + ">" + ">=" + "==" + "~=" + "=" + "&&" + "||" + ":" +] @operator + +; Literals +(string) @string + +(escape_sequence) @string.escape + +(formatting_sequence) @string.special + +(number) @number + +(boolean) @boolean + +; Comments +[ + (comment) + (line_continuation) +] @comment @spell + +((comment) @keyword.directive + (#lua-match? @keyword.directive "^%%%% ")) diff --git a/runtime/queries/matlab/indents.scm b/runtime/queries/matlab/indents.scm new file mode 100644 index 000000000..d446f45df --- /dev/null +++ b/runtime/queries/matlab/indents.scm @@ -0,0 +1,40 @@ +"end" @indent.end @indent.branch + +[ + (arguments_statement) + (if_statement) + (for_statement) + (while_statement) + (switch_statement) + (try_statement) + (function_definition) + (class_definition) + (enumeration) + (events) + (methods) + (properties) +] @indent.begin + +[ + "elseif" + "else" + "case" + "otherwise" + "catch" +] @indent.branch + +((matrix + (row) @indent.align) + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) + +((cell + (row) @indent.align) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) + +((parenthesis) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +(comment) @indent.auto diff --git a/runtime/queries/matlab/injections.scm b/runtime/queries/matlab/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/matlab/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/matlab/locals.scm b/runtime/queries/matlab/locals.scm new file mode 100644 index 000000000..366c82027 --- /dev/null +++ b/runtime/queries/matlab/locals.scm @@ -0,0 +1,33 @@ +; References +(identifier) @local.reference + +; Definitions +(function_definition + name: (identifier) @local.definition.function + (function_arguments + (identifier)* @local.definition.parameter + ("," + (identifier) @local.definition.parameter)*)?) @local.scope + +(assignment + left: (identifier) @local.definition.var) + +(multioutput_variable + (identifier) @local.definition.var) + +(iterator + . + (identifier) @local.definition.var) + +(lambda + (arguments + (identifier) @local.definition.parameter)) + +(global_operator + (identifier) @local.definition.var) + +(persistent_operator + (identifier) @local.definition.var) + +(catch_clause + (identifier) @local.definition) |
