Skip to content

Commit

Permalink
queries: Fix precedence in Erlang highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Feb 26, 2025
1 parent fcddd50 commit e1060a2
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions runtime/queries/erlang/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

; Basic types
(variable) @variable
(atom) @string.special.symbol
((atom) @constant.builtin.boolean
(#match? @constant.builtin.boolean "^(true|false)$"))
(atom) @string.special.symbol
[(string) (sigil)] @string
(character) @constant.character
(escape_sequence) @constant.character.escape
Expand All @@ -20,6 +20,10 @@
["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket

; Operators
(binary_operator operator: _ @operator)
(unary_operator operator: _ @operator)
["/" ":" "->"] @operator

(binary_operator
left: (atom) @function
operator: "/"
Expand All @@ -30,10 +34,13 @@
((unary_operator operator: _ @keyword.operator)
(#match? @keyword.operator "^\\w+$"))

(binary_operator operator: _ @operator)
(unary_operator operator: _ @operator)
["/" ":" "->"] @operator

; Functions
(function_clause name: (atom) @function)
(call module: (atom) @namespace)
(call function: (atom) @function)
(stab_clause name: (atom) @function)
(function_capture module: (atom) @namespace)
(function_capture function: (atom) @function)

; Keywords
(attribute name: (atom) @keyword)
Expand Down Expand Up @@ -107,13 +114,9 @@
] @comment.block.documentation)
(#any-of? @keyword "doc" "moduledoc"))

; Functions
(function_clause name: (atom) @function)
(call module: (atom) @namespace)
(call function: (atom) @function)
(stab_clause name: (atom) @function)
(function_capture module: (atom) @namespace)
(function_capture function: (atom) @function)
; Ignored variables
((variable) @comment.discard
(#match? @comment.discard "^_"))

; Macros
(macro
Expand All @@ -125,10 +128,6 @@
"?"+ @keyword.directive
name: (_) @keyword.directive)

; Ignored variables
((variable) @comment.discard
(#match? @comment.discard "^_"))

; Parameters
; specs
((attribute
Expand Down

0 comments on commit e1060a2

Please sign in to comment.