Skip to content

Commit

Permalink
Update gleam grammar and queries (#9003)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunagl committed Dec 5, 2023
1 parent 4c2bd49 commit c3cb179
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 16 additions & 5 deletions runtime/queries/gleam/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -60,10 +69,6 @@
(identifier) @variable
(discard) @comment.unused

; Operators
(binary_expression
operator: _ @operator)

; Keywords
[
(visibility_modifier) ; "pub"
Expand All @@ -72,18 +77,24 @@
"assert"
"case"
"const"
; DEPRECATED: 'external' was removed in v0.30.
"external"
"fn"
"if"
"import"
"let"
"panic"
"todo"
"try"
"type"
"use"
] @keyword

; Operators
(binary_expression
operator: _ @operator)
(boolean_negation "!" @operator)
(integer_negation "-" @operator)

; Punctuation
[
"("
Expand Down

0 comments on commit c3cb179

Please sign in to comment.