feat(erlang)!: switch parser to maintained fork (#3791)

update queries to breaking changes
This commit is contained in:
Benedikt Reinartz 2022-12-08 19:40:41 +01:00 committed by GitHub
parent 0b00eb4b82
commit 84261c67fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 79 deletions

View file

@ -90,7 +90,7 @@
"revision": "91fc5ae1140d5c9d922312431f7d251a48d7b8ce" "revision": "91fc5ae1140d5c9d922312431f7d251a48d7b8ce"
}, },
"erlang": { "erlang": {
"revision": "3a9c769444f08bbccce03845270efac0c641c5e7" "revision": "a8b8b0e16c4f5552f5e85af3dec976a5d16af8b9"
}, },
"fennel": { "fennel": {
"revision": "517195970428aacca60891b050aa53eabf4ba78d" "revision": "517195970428aacca60891b050aa53eabf4ba78d"

View file

@ -412,11 +412,11 @@ list.scss = {
list.erlang = { list.erlang = {
install_info = { install_info = {
url = "https://github.com/AbstractMachinesLab/tree-sitter-erlang", url = "https://github.com/WhatsApp/tree-sitter-erlang",
files = { "src/parser.c" }, files = { "src/parser.c" },
branch = "main", branch = "main",
}, },
maintainers = { "@ostera" }, maintainers = { "@filmor" },
} }
list.elixir = { list.elixir = {

View file

@ -1,7 +1,8 @@
[ [
(function_declaration) (fun_decl)
(lambda_clause) (anonymous_fun)
(expr_case) (case_expr)
(map) (map_expr)
(module_export) (export_attribute)
(export_type_attribute)
] @fold ] @fold

View file

@ -1,8 +1,18 @@
;; keywoord ((atom) @constant (#set! "priority" "90"))
(var) @variable
(char) @character
(integer) @number
(float) @float
(comment) @comment
;; keyword
[ [
"fun" "fun"
"div" "div"
] @keyword ] @keyword
;; bracket ;; bracket
[ [
"(" "("
@ -11,10 +21,41 @@
"}" "}"
"[" "["
"]" "]"
"#" "#"
] @punctuation.bracket ] @punctuation.bracket
;; conditional
;;; Comparisons
[ [
"=="
"=:="
"=/="
"=<"
">="
"<"
">"
] @operator ;; .comparison
;;; operator
[
":"
":="
"!"
;; "-"
"+"
"="
"->"
"=>"
"|"
] @operator
[
","
"."
";"
] @punctuation.delimiter
;; conditional
([
"receive" "receive"
"if" "if"
"case" "case"
@ -22,83 +63,62 @@
"when" "when"
"after" "after"
"end" "end"
] @conditional ] @conditional (#set! "priority" 95))
[ [
"catch" "catch"
"try" "try"
"throw"
] @exception ] @exception
;;; module define
[ ((atom) @boolean (#any-of? @boolean "true" "false"))
"module"
"export" ;; Macros
] @include ((macro_call_expr) @constant.macro (#set! "priority" 101))
;;; operator
[ ;; Preprocessor
":" (pp_define
":=" lhs: _ @constant.macro (#set! "priority" 101)
"?" )
"!" (_preprocessor_directive) @preproc (#set! "priority" 99)
"-"
"+" ;; Attributes
"=" (pp_include) @include
"->" (pp_include_lib) @include
"=>" (export_attribute) @include
"|" (export_type_attribute) @type.definition
;;;TODO (export_type_attribute types: (fa fun: _ @type (#set! "priority" 101)))
"$" (behaviour_attribute) @include
] @operator (module_attribute (atom) @namespace) @include
(wild_attribute name: (attr_name name: _ @attribute)) @attribute
;; Records
(record_expr) @type
(record_field_expr _ @field) @type
(record_field_name _ @field) @type
(record_name "#" @type name: _ @type) @type
(record_decl name: _ @type) @type.definition
(record_field name: _ @field)
(record_field name: _ @field ty: _ @type)
;; Type alias
(type_alias name: _ @type) @type.definition
(spec) @type.definition
(comment) @comment (comment) @comment
(string) @string [(string) (binary)] @string
(variable) @variable
(module_name
(atom) @namespace
)
;;; expr_function_call ;;; expr_function_call
(expr_function_call (call expr: [(atom) (remote) (var)] @function)
name: (computed_function_name) @function.call (call (atom) @exception (#any-of? @exception "error" "throw" "exit"))
)
(expr_function_call ;;; Parenthesized expression: (SomeFunc)(), only highlight the parens
arguments: (atom) @variable (call
) expr: (paren_expr "(" @function.call ")" @function.call)
;;; 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 ;;; function
(qualified_function_name (external_fun) @function.call
module_name: (atom) @attribute (internal_fun fun: (atom) @function.call)
function_name: (atom) @function (function_clause name: (atom) @function)
) (fa fun: (atom) @function)
;; function
(function_clause
name: (atom) @function)
;;;lambda
(lambda_clause
arguments:
(pattern) @variable
)