aboutsummaryrefslogtreecommitdiffstats
path: root/queries/erlang
diff options
context:
space:
mode:
authorAccess <ShootingStarDragons@protonmail.com>2022-07-09 16:55:48 +0800
committerGitHub <noreply@github.com>2022-07-09 10:55:48 +0200
commitab3183107a34a0364888273239365fc868a5385c (patch)
treea7aa2d1f4e408863cd0809313f88eb5ad7ca71f4 /queries/erlang
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.tar
nvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.tar.gz
nvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.tar.bz2
nvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.tar.lz
nvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.tar.xz
nvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.tar.zst
nvim-treesitter-ab3183107a34a0364888273239365fc868a5385c.zip
feat(erlang highlight): support erlang highlight (#3141)
Diffstat (limited to 'queries/erlang')
-rw-r--r--queries/erlang/folds.scm6
-rw-r--r--queries/erlang/highlights.scm101
2 files changed, 107 insertions, 0 deletions
diff --git a/queries/erlang/folds.scm b/queries/erlang/folds.scm
new file mode 100644
index 000000000..e15c71420
--- /dev/null
+++ b/queries/erlang/folds.scm
@@ -0,0 +1,6 @@
+[
+ (function_declaration)
+ (lambda_clause)
+ (expr_case)
+ (map)
+] @fold
diff --git a/queries/erlang/highlights.scm b/queries/erlang/highlights.scm
new file mode 100644
index 000000000..713e4fea2
--- /dev/null
+++ b/queries/erlang/highlights.scm
@@ -0,0 +1,101 @@
+;; keywoord
+[
+ "fun"
+ "div"
+] @keyword
+;; bracket
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+ "#"
+] @punctuation.bracket
+;; conditional
+[
+ "receive"
+ "try"
+ "throw"
+ "catch"
+ "if"
+ "case"
+ "of"
+ "when"
+ "after"
+ "end"
+] @conditional
+;;; module define
+[
+ "module"
+ "export"
+] @include
+;;; operator
+[
+ ":"
+ ":="
+ "?"
+ "!"
+ "-"
+ "+"
+ "="
+ "->"
+ "=>"
+ "|"
+ ;;;TODO
+ "$"
+ ] @operator
+
+(comment) @comment
+(string) @string
+(variable) @variable
+
+(module_name
+ (atom) @namespace
+)
+;;; expr_function_call
+(expr_function_call
+ name: (computed_function_name) @function
+)
+
+(expr_function_call
+ arguments: (atom) @variable
+)
+
+;;; map
+(map
+ (map_entry [
+ (atom)
+ (variable)
+ ] @variable)
+)
+
+
+(tuple (atom) @variable)
+(pat_tuple ( pattern (atom) @variable))
+
+(computed_function_name) @function
+;;; case
+(case_clause
+ pattern: (pattern
+ (atom) @variable
+ )
+)
+(case_clause
+ body: (atom) @variable
+)
+
+;;; function
+(qualified_function_name
+ module_name: (atom) @attribute
+ function_name: (atom) @function
+)
+;; function
+(function_clause
+ name: (atom) @function)
+;;;lambda
+(lambda_clause
+ arguments:
+ (pattern) @variable
+)