Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

erlang: Update tree-sitter grammar and query files (#15973)

Thanabodee Charoenpiriyakijf5532afaa747
diff --git a/extensions/erlang/extension.toml b/extensions/erlang/extension.toml
index 3d9dbb86759..863da32dfa7 100644
--- a/extensions/erlang/extension.toml
+++ b/extensions/erlang/extension.toml
@@ -16,4 +16,4 @@ language = "Erlang"
[grammars.erlang]
repository = "https://github.com/WhatsApp/tree-sitter-erlang"
-commit = "57e69513efd831f9cc8207d65d96bad917ca4aa4"
+commit = "19ca500fa5a17ab58dc18aa03b50e2db305e7a8a"
diff --git a/extensions/erlang/languages/erlang/highlights.scm b/extensions/erlang/languages/erlang/highlights.scm
index c4abf047767..4c0b24781dc 100644
--- a/extensions/erlang/languages/erlang/highlights.scm
+++ b/extensions/erlang/languages/erlang/highlights.scm
@@ -20,11 +20,46 @@
;; https://github.com/the-mikedavis/tree-sitter-erlang/tree/main/test/highlight
;;
+;; Last match wins in this file.
+;; As of https://github.com/tree-sitter/tree-sitter/blob/master/CHANGELOG.md#breaking-1
-;; First match wins in this file
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Primitive types
+(string) @string
+(char) @constant
+(integer) @number
+(var) @variable
+(atom) @string.special.symbol
+
+;;; Comments
+((var) @comment.discard
+ (#match? @comment.discard "^_"))
+
+(dotdotdot) @comment.discard
+(comment) @comment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Functions
+(fa fun: (atom) @function)
+(type_name name: (atom) @function)
+(call expr: (atom) @function)
+(function_clause name: (atom) @function)
+(internal_fun fun: (atom) @function)
+;; This is a fudge, we should check that the operator is '/'
+;; But our grammar does not (currently) provide it
+(binary_op_expr lhs: (atom) @function rhs: (integer))
+
+;; Others
+(remote_module module: (atom) @module)
+(remote fun: (atom) @function)
+(macro_call_expr name: (var) @constant)
+(macro_call_expr name: (var) @keyword.directive args: (_) )
+(macro_call_expr name: (atom) @keyword.directive)
+(record_field_name name: (atom) @property)
+(record_name name: (atom) @type)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Attributes
;; module attribute
@@ -73,6 +108,9 @@
;; callback
(callback fun: (atom) @function)
+;; wild attribute
+(wild_attribute name: (attr_name name: (atom) @keyword))
+
;; fun decl
;; include/include_lib
@@ -84,33 +122,12 @@
;; define
(pp_define
lhs: (macro_lhs
- name: (_) @keyword.directive
- args: (var_args args: (var))))
+ name: (var) @constant))
(pp_define
lhs: (macro_lhs
- name: (var) @constant))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Functions
-(fa fun: (atom) @function)
-(type_name name: (atom) @function)
-(call expr: (atom) @function)
-(function_clause name: (atom) @function)
-(internal_fun fun: (atom) @function)
-
-;; This is a fudge, we should check that the operator is '/'
-;; But our grammar does not (currently) provide it
-(binary_op_expr lhs: (atom) @function rhs: (integer))
+ name: (_) @keyword.directive
+ args: (var_args args: (var))))
-;; Others
-(remote_module module: (atom) @module)
-(remote fun: (atom) @function)
-(macro_call_expr name: (var) @keyword.directive args: (_) )
-(macro_call_expr name: (var) @constant)
-(macro_call_expr name: (atom) @keyword.directive)
-(record_field_name name: (atom) @property)
-(record_name name: (atom) @type)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Reserved words
@@ -212,20 +229,3 @@
"=:="
"=/="
] @operator
-
-;;; Comments
-((var) @comment.discard
- (#match? @comment.discard "^_"))
-
-(dotdotdot) @comment.discard
-(comment) @comment
-
-;; Primitive types
-(string) @string
-(char) @constant
-(integer) @number
-(var) @variable
-(atom) @string.special.symbol
-
-;; wild attribute (Should take precedence over atoms, otherwise they are highlighted as atoms)
-(wild_attribute name: (attr_name name: (_) @keyword))