diff --git a/queries/highlights.scm b/queries/highlights.scm index 5855b96..2736fd5 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -1,44 +1,28 @@ ; This Source Form is subject to the terms of the AQUA Software License, ; v. 1.0. Copyright (c) 2024 Aymeric Wibo +; The order of these captures is important; the last match is the one that is used. +; So start off with all the matches on primitive constructs, and then do the more complex stuff after. + ; Comments. (comment) @comment (doc_comment) @comment.documentation -; function calls - -(call - callable: (expression (identifier)) @function -) - -; builtins - -[ - "print" - "assert" -] @function.builtin - -; identifiers +; Identifiers. (identifier) @variable -; operators - -(overloadable_operator) @operator +; Literals. -; declarations +(string) @string +(number) @number +(bool) @constant.builtin +(none) @constant.builtin -(var_decl name: (identifier) type: (type) @variable) -(function_declaration name: - [ - (identifier) - (overloadable_operator) - ] @function -) -(class_declaration name: (identifier) @class) +; Operators. -; operators +(overloadable_operator) @operator [ "**" @@ -58,7 +42,7 @@ "^^" ] @operator -; keywords +; Keywords. [ "extern" @@ -67,9 +51,17 @@ "class" "import" "return" + "let" ] @keyword -; types +; Builtins. + +[ + "print" + "assert" +] @function.builtin + +; Types. (type_name) @type [ @@ -78,9 +70,23 @@ "map" ] @type.builtin -; literals +; Function calls. -(string) @string -(number) @number -(bool) @constant.builtin -(none) @constant.builtin +(call + callable: (expression (identifier) @function.method) +) + +(call + callable: (expression (access accessor: (identifier) @function.method)) +) + +; Declarations. + +(var_decl name: (identifier) type: (type) @variable) +(function_declaration name: + [ + (identifier) + (overloadable_operator) + ] @function +) +(class_declaration name: (identifier) @function)