1["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
2
3(unary_operator
4 operator: "&"
5 operand: (integer) @operator)
6
7(operator_identifier) @operator
8
9(unary_operator
10 operator: _ @operator)
11
12(binary_operator
13 operator: _ @operator)
14
15(dot
16 operator: _ @operator)
17
18(stab_clause
19 operator: _ @operator)
20
21[
22 (boolean)
23 (nil)
24] @constant
25
26[
27 (integer)
28 (float)
29] @number
30
31(alias) @type
32
33(call
34 target: (dot
35 left: (atom) @type))
36
37(char) @constant
38
39(escape_sequence) @string.escape
40
41[
42 (atom)
43 (quoted_atom)
44 (keyword)
45 (quoted_keyword)
46] @string.special.symbol
47
48[
49 (string)
50 (charlist)
51] @string
52
53(sigil
54 (sigil_name) @__name__
55 quoted_start: _ @string
56 quoted_end: _ @string
57 (#match? @__name__ "^[sS]$")) @string
58
59(sigil
60 (sigil_name) @__name__
61 quoted_start: _ @string.regex
62 quoted_end: _ @string.regex
63 (#match? @__name__ "^[rR]$")) @string.regex
64
65(sigil
66 (sigil_name) @__name__
67 quoted_start: _ @string.special
68 quoted_end: _ @string.special) @string.special
69
70(identifier) @variable
71
72(
73 (identifier) @comment.unused
74 (#match? @comment.unused "^_")
75)
76
77(call
78 target: [
79 (identifier) @function
80 (dot
81 right: (identifier) @function)
82 ])
83
84(call
85 target: (identifier) @keyword
86 (arguments
87 [
88 (identifier) @function
89 (binary_operator
90 left: (identifier) @function
91 operator: "when")
92 (binary_operator
93 operator: "|>"
94 right: (identifier))
95 ])
96 (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
97
98(binary_operator
99 operator: "|>"
100 right: (identifier) @function)
101
102(call
103 target: (identifier) @keyword
104 (#match? @keyword "^(def|defdelegate|defexception|defguard|defguardp|defimpl|defmacro|defmacrop|defmodule|defn|defnp|defoverridable|defp|defprotocol|defstruct)$"))
105
106(call
107 target: (identifier) @keyword
108 (#match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
109
110(
111 (identifier) @constant.builtin
112 (#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
113)
114
115(unary_operator
116 operator: "@" @comment.doc
117 operand: (call
118 target: (identifier) @__attribute__ @comment.doc
119 (arguments
120 [
121 (string)
122 (charlist)
123 (sigil)
124 (boolean)
125 ] @comment.doc))
126 (#match? @__attribute__ "^(moduledoc|typedoc|doc)$"))
127
128(comment) @comment
129
130[
131 "%"
132] @punctuation
133
134[
135 ","
136 ";"
137] @punctuation.delimiter
138
139[
140 "("
141 ")"
142 "["
143 "]"
144 "{"
145 "}"
146 "<<"
147 ">>"
148] @punctuation.bracket
149
150(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
151
152((sigil
153 (sigil_name) @_sigil_name
154 (quoted_content) @embedded)
155 (#eq? @_sigil_name "H"))