highlights.scm

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