From ab3183107a34a0364888273239365fc868a5385c Mon Sep 17 00:00:00 2001 From: Access Date: Sat, 9 Jul 2022 16:55:48 +0800 Subject: [PATCH] feat(erlang highlight): support erlang highlight (#3141) --- queries/erlang/folds.scm | 6 ++ queries/erlang/highlights.scm | 101 ++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 queries/erlang/folds.scm create mode 100644 queries/erlang/highlights.scm 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 +)