aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/matlab/highlights.scm
blob: c0e23e91754191c67148346382289f87a9cd4aeb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  ; highlights.scm

function_keyword: (function_keyword) @keyword.function

(function_definition
function_name: (identifier) @function
(end) @function)

(parameter_list (identifier) @variable.parameter)

[
    "if"
    "elseif"
    "else"
    "switch"
    "case"
    "otherwise"
] @keyword.control.conditional

(if_statement (end) @keyword.control.conditional)
(switch_statement (end) @keyword.control.conditional)

["for" "while"] @keyword.control.repeat
(for_statement (end) @keyword.control.repeat)
(while_statement (end) @keyword.control.repeat)

["try" "catch"] @keyword.control.exception
(try_statement (end) @keyword.control.exception)

(function_definition end: (end) @keyword)

["return" "break" "continue"] @keyword.return

(
(identifier) @constant.builtin
(#any-of? @constant.builtin "true" "false")
)

(
    (identifier) @constant.builtin
    (#eq? @constant.builtin "end")
)

;; Punctuations

[";" ","] @punctuation.special
(argument_list "," @punctuation.delimiter)
(vector_definition ["," ";"] @punctuation.delimiter)
(cell_definition ["," ";"] @punctuation.delimiter)
":" @punctuation.delimiter
(parameter_list "," @punctuation.delimiter)
(return_value "," @punctuation.delimiter)

; ;; Brackets

[
 "("
 ")"
 "["
 "]"
 "{"
 "}"
] @punctuation.bracket

;; Operators
"=" @operator
(operation [ ">"
            "<"
            "=="
            "<="
            ">="
            "=<"
            "=>"
            "~="
            "*"
            ".*"
            "/"
            "\\"
            "./"
            "^"
            ".^"
            "+"] @operator)

;; boolean operator
[
    "&&"
    "||"
] @operator

;; Number
(number) @constant.numeric

;; String
(string) @string

;; Comment
(comment) @comment