From 7a112044f6e2e24287516a6b0abc3b4c74cf7211 Mon Sep 17 00:00:00 2001 From: Frederick Schwalbe <88447041+fschwalbe@users.noreply.github.com> Date: Tue, 5 Dec 2023 14:54:00 +0100 Subject: [PATCH] Update gleam grammar and queries (#9003) --- languages.toml | 2 +- runtime/queries/gleam/highlights.scm | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/languages.toml b/languages.toml index dd849c477f3a..66b43472f5a3 100644 --- a/languages.toml +++ b/languages.toml @@ -1624,7 +1624,7 @@ auto-format = true [[grammar]] name = "gleam" -source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "a59aadf3d7c11702cad244e7cd6b67b34ca9c16a" } +source = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "b2afa4fd6bb41a7bf912b034c653c90af7ae5122" } [[language]] name = "ron" diff --git a/runtime/queries/gleam/highlights.scm b/runtime/queries/gleam/highlights.scm index 56222b8fd2c3..95a08141bd51 100644 --- a/runtime/queries/gleam/highlights.scm +++ b/runtime/queries/gleam/highlights.scm @@ -21,6 +21,8 @@ ; Functions (unqualified_import (identifier) @function) +(unqualified_import "type" (type_identifier) @type) +(unqualified_import (type_identifier) @constructor) (function name: (identifier) @function) (external_function @@ -43,6 +45,13 @@ (tuple_access index: (integer) @variable.other.member) +; Attributes +(attribute + "@" @attribute + name: (identifier) @attribute) + +(attribute_value (identifier) @constant) + ; Type names (remote_type_identifier) @type (type_identifier) @type @@ -60,10 +69,6 @@ (identifier) @variable (discard) @comment.unused -; Operators -(binary_expression - operator: _ @operator) - ; Keywords [ (visibility_modifier) ; "pub" @@ -72,6 +77,7 @@ "assert" "case" "const" + ; DEPRECATED: 'external' was removed in v0.30. "external" "fn" "if" @@ -79,11 +85,16 @@ "let" "panic" "todo" - "try" "type" "use" ] @keyword +; Operators +(binary_expression + operator: _ @operator) +(boolean_negation "!" @operator) +(integer_negation "-" @operator) + ; Punctuation [ "("