highlights.scm

  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(
 71  (identifier) @comment.unused
 72  (#match? @comment.unused "^_")
 73)
 74
 75(call
 76  target: [
 77    (identifier) @function
 78    (dot
 79      right: (identifier) @function)
 80  ])
 81
 82(call
 83  target: (identifier) @keyword
 84  (arguments
 85    [
 86      (identifier) @function
 87      (binary_operator
 88        left: (identifier) @function
 89        operator: "when")
 90      (binary_operator
 91        operator: "|>"
 92        right: (identifier))
 93    ])
 94  (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
 95
 96(binary_operator
 97  operator: "|>"
 98  right: (identifier) @function)
 99
100(call
101  target: (identifier) @keyword
102  (#match? @keyword "^(def|defdelegate|defexception|defguard|defguardp|defimpl|defmacro|defmacrop|defmodule|defn|defnp|defoverridable|defp|defprotocol|defstruct)$"))
103
104(call
105  target: (identifier) @keyword
106  (#match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
107
108(
109  (identifier) @constant.builtin
110  (#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
111)
112
113(unary_operator
114  operator: "@" @comment.doc
115  operand: (call
116    target: (identifier) @__attribute__ @comment.doc
117    (arguments
118      [
119        (string)
120        (charlist)
121        (sigil)
122        (boolean)
123      ] @comment.doc))
124  (#match? @__attribute__ "^(moduledoc|typedoc|doc)$"))
125
126(comment) @comment
127
128[
129 "%"
130] @punctuation
131
132[
133 ","
134 ";"
135] @punctuation.delimiter
136
137[
138  "("
139  ")"
140  "["
141  "]"
142  "{"
143  "}"
144  "<<"
145  ">>"
146] @punctuation.bracket
147
148(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
149
150((sigil
151  (sigil_name) @_sigil_name
152  (quoted_content) @embedded)
153 (#eq? @_sigil_name "H"))