Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/matlab/highlights.scm')
| -rw-r--r-- | runtime/queries/matlab/highlights.scm | 185 |
1 files changed, 77 insertions, 108 deletions
diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm index 875cba50..c0e23e91 100644 --- a/runtime/queries/matlab/highlights.scm +++ b/runtime/queries/matlab/highlights.scm @@ -1,128 +1,97 @@ -; Constants + ; highlights.scm -(events (identifier) @constant) -(attribute (identifier) @constant) - -"~" @constant.builtin - -; Fields/Properties - -(superclass "." (identifier) @variable.other.member) -(property_name "." (identifier) @variable.other.member) -(property name: (identifier) @variable.other.member) - -; Types - -(class_definition name: (identifier) @keyword.storage.type) -(attributes (identifier) @constant) -(enum . (identifier) @type.enum.variant) - -; Functions +function_keyword: (function_keyword) @keyword.function (function_definition - "function" @keyword.function - name: (identifier) @function - [ "end" "endfunction" ]? @keyword.function) - -(function_signature name: (identifier) @function) -(function_call name: (identifier) @function) -(handle_operator (identifier) @function) -(validation_functions (identifier) @function) -(command (command_name) @function.macro) -(command_argument) @string -(return_statement) @keyword.control.return - -; Assignments - -(assignment left: (_) @variable) -(multioutput_variable (_) @variable) +function_name: (identifier) @function +(end) @function) -; Parameters +(parameter_list (identifier) @variable.parameter) -(function_arguments (identifier) @variable.parameter) - -; Conditionals - -(if_statement [ "if" "end" ] @keyword.control.conditional) -(elseif_clause "elseif" @keyword.control.conditional) -(else_clause "else" @keyword.control.conditional) -(switch_statement [ "switch" "end" ] @keyword.control.conditional) -(case_clause "case" @keyword.control.conditional) -(otherwise_clause "otherwise" @keyword.control.conditional) -(break_statement) @keyword.control.conditional - -; Repeats +[ + "if" + "elseif" + "else" + "switch" + "case" + "otherwise" +] @keyword.control.conditional -(for_statement [ "for" "parfor" "end" ] @keyword.control.repeat) -(while_statement [ "while" "end" ] @keyword.control.repeat) -(continue_statement) @keyword.control.repeat +(if_statement (end) @keyword.control.conditional) +(switch_statement (end) @keyword.control.conditional) -; Exceptions +["for" "while"] @keyword.control.repeat +(for_statement (end) @keyword.control.repeat) +(while_statement (end) @keyword.control.repeat) -(try_statement [ "try" "end" ] @keyword.control.exception) -(catch_clause "catch" @keyword.control.exception) +["try" "catch"] @keyword.control.exception +(try_statement (end) @keyword.control.exception) -; Punctuation +(function_definition end: (end) @keyword) -[ ";" "," "." ] @punctuation.delimiter -[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket +["return" "break" "continue"] @keyword.return -; Literals +( +(identifier) @constant.builtin +(#any-of? @constant.builtin "true" "false") +) -(escape_sequence) @constant.character.escape -(formatting_sequence) @constant.character.escape -(string) @string -(number) @constant.numeric.float -(unary_operator ["+" "-"] @constant.numeric.float) -(boolean) @constant.builtin.boolean +( + (identifier) @constant.builtin + (#eq? @constant.builtin "end") +) -; Comments +;; Punctuations -[ (comment) (line_continuation) ] @comment.line +[";" ","] @punctuation.special +(argument_list "," @punctuation.delimiter) +(vector_definition ["," ";"] @punctuation.delimiter) +(cell_definition ["," ";"] @punctuation.delimiter) +":" @punctuation.delimiter +(parameter_list "," @punctuation.delimiter) +(return_value "," @punctuation.delimiter) -; Operators +; ;; Brackets [ - "+" - ".+" - "-" - ".*" - "*" - ".*" - "/" - "./" - "\\" - ".\\" - "^" - ".^" - "'" - ".'" - "|" - "&" - "?" - "@" - "<" - "<=" - ">" - ">=" - "==" - "~=" - "=" - "&&" - "||" - ":" + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +;; Operators +"=" @operator +(operation [ ">" + "<" + "==" + "<=" + ">=" + "=<" + "=>" + "~=" + "*" + ".*" + "/" + "\\" + "./" + "^" + ".^" + "+"] @operator) + +;; boolean operator +[ + "&&" + "||" ] @operator -; Keywords +;; Number +(number) @constant.numeric -"classdef" @keyword.storage.type -[ - "arguments" - "end" - "enumeration" - "events" - "global" - "methods" - "persistent" - "properties" -] @keyword +;; String +(string) @string + +;; Comment +(comment) @comment |