aboutsummaryrefslogtreecommitdiffstats
path: root/queries/elixir/highlights.scm
diff options
context:
space:
mode:
authorDaniel Kempkens <daniel+git@kempkens.io>2021-05-14 21:23:58 +0200
committerStephan Seitz <stephan.lauf@yahoo.de>2021-05-18 19:10:06 +0200
commite7e1db38cd966ea1e382c321dd589378393ff186 (patch)
tree53e1db7efc6bfb47a4d1da1fca633c4d36a9a087 /queries/elixir/highlights.scm
parenthighlights(c/c++): "..." also exists in C (variadic macros) (diff)
downloadnvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.tar
nvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.tar.gz
nvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.tar.bz2
nvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.tar.lz
nvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.tar.xz
nvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.tar.zst
nvim-treesitter-e7e1db38cd966ea1e382c321dd589378393ff186.zip
Initial Elixir support
Diffstat (limited to 'queries/elixir/highlights.scm')
-rw-r--r--queries/elixir/highlights.scm190
1 files changed, 190 insertions, 0 deletions
diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm
new file mode 100644
index 000000000..7fcd34ac8
--- /dev/null
+++ b/queries/elixir/highlights.scm
@@ -0,0 +1,190 @@
+(identifier) @variable
+
+(interpolation
+ "#{" @punctuation.special
+ "}" @punctuation.special) @none
+
+[
+ "after"
+ "do"
+ "end"
+] @keyword
+
+[
+ "and"
+ "in"
+ "not"
+ "not in"
+ "or"
+] @keyword.operator
+
+(call (function_identifier) @method)
+
+(call (function_identifier) @keyword
+ (#any-of? @keyword
+ "quote"
+ "receive"
+ "self"
+ "super"
+ "unquote"
+ "unquote_splicing"
+ "with"
+ "assert"
+ "assert_in_delta"
+ "assert_raise"
+ "assert_receive"
+ "assert_received"
+ "catch_error"
+ "catch_exit"
+ "catch_throw"
+ "flunk"
+ "refute"
+ "refute_in_delta"
+ "refute_receive"
+ "refute_received"))
+
+"fn" @keyword.function
+
+(call (function_identifier) @keyword.function
+ (#lua-match? @keyword.function "^def%a*$"))
+
+(call (function_identifier) @keyword.function
+ (#any-of? @keyword.function "describe" "doctest" "on_exit" "setup" "setup_all" "test"))
+
+"else" @conditional
+
+(call (function_identifier) @conditional
+ (#any-of? @conditional "case" "cond" "if" "unless"))
+
+(call (function_identifier) @repeat
+ (#eq? @repeat "for"))
+
+(call (function_identifier) @include
+ (#any-of? @include "alias" "import" "require" "use"))
+
+[
+ "catch"
+ "rescue"
+] @exception
+
+(call (function_identifier) @exception
+ (#any-of? @exception "raise" "try"))
+
+[
+ (heredoc_content)
+ (sigil_content)
+ (string_content)
+ (string_end)
+ (string_start)
+] @string
+
+[
+ (heredoc_end)
+ (heredoc_start)
+ (sigil_end)
+ (sigil_start)
+] @string.special
+
+(sigil
+ (sigil_start) @_sigil-type
+ [(sigil_content) (escape_sequence)] @string.regex
+ (sigil_end)
+ (#lua-match? @_sigil-type "^~r"))
+
+(module) @type
+
+[(atom) (keyword)] @symbol
+
+(escape_sequence) @string.escape
+(integer) @number
+(float) @float
+
+[(true) (false)] @boolean
+
+(nil) @constant.builtin
+
+(comment) @comment
+
+"->" @operator
+
+(unary_op
+ operator: _ @operator)
+
+(binary_op
+ operator: _ @operator)
+
+(unary_op
+ operator: "@" @attribute
+ [(call
+ function: (function_identifier) @attribute)
+ (identifier) @attribute])
+
+(unary_op
+ operator: "@"
+ (call (function_identifier) @attribute
+ (heredoc
+ [(heredoc_start)
+ (heredoc_content)
+ (heredoc_end)] @string))
+ (#any-of? @attribute "doc" "moduledoc"))
+
+(unary_op
+ operator: "@"
+ (call (function_identifier) @attribute
+ (binary_op
+ left: (identifier) @method))
+ (#eq? @attribute "spec"))
+
+[
+ ","
+ "."
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ "<<"
+ ">>"
+] @punctuation.bracket
+
+(dot_call
+ remote: [(atom) (module)] @type
+ function: (function_identifier) @method)
+
+(call (function_identifier) @keyword.function
+ [(call
+ (function_identifier) @function)
+ (call
+ function: (function_identifier) @function
+ (arguments
+ [(identifier) @parameter
+ (binary_op
+ left: (identifier) @parameter)]))
+ (identifier) @function
+ (binary_op
+ left:
+ [(call
+ function: (function_identifier) @function
+ (arguments
+ [(identifier) @parameter
+ (binary_op
+ left: (identifier) @parameter)]))
+ (identifier) @function]
+ operator: "when")
+ (binary_op
+ left: (identifier)
+ operator: _ @function
+ right: (identifier))]
+ (#lua-match? @keyword.function "^def%a*$"))
+
+((identifier) @comment
+ (#lua-match? @comment "^_[%a%d_]*$"))
+
+((identifier) @constant.builtin
+ (#lua-match? @constant.builtin "^__[%a%d_]+__$"))
+
+(ERROR) @error