diff options
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/haskell/highlights.scm | 111 |
1 files changed, 72 insertions, 39 deletions
diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index d999cb8ec..52fd4fbbd 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -1,17 +1,36 @@ +;; ---------------------------------------------------------------------------- +;; Literals and comments + (integer) @number +(exp_negation) @number (exp_literal (float)) @float - (char) @character - (string) @string -(variable) @variable - -(con_unit) @symbol +(con_unit) @symbol ; unit, as in () (comment) @comment -(function name: (variable) @function) +;; ---------------------------------------------------------------------------- +;; Punctuation + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +[ + (comma) + ";" +] @punctuation.delimiter + + +;; ---------------------------------------------------------------------------- +;; Keywords, operators, includes [ "forall" @@ -24,37 +43,39 @@ "if" "then" "else" + "case" + "of" ] @conditional [ - (constructor) - (module) -] @constructor - -;; True or False -((constructor) @_bool (#match? @_bool "(True|False)")) @boolean - -(signature name: (variable) @type) -(constraint class: (class_name (type)) @type) -(class (class_head class: (class_name (type)) @type)) -(instance (instance_head class: (class_name (type)) @type)) - -[ - (type) -] @type + "import" + "qualified" + "module" +] @include [ - (qualified_module) ;; grabs the `.` (dot), ex: import System.IO - (tycon_arrow) (operator) (constructor_operator) + (type_operator) + (tycon_arrow) + (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (all_names) + (wildcard) + "=" + "|" "::" + "=>" + "->" + "<-" + "\\" + "`" + "@" ] @operator -[ - "import" - "module" -] @include +(qualified_module (module) @constructor) +(qualified_type (module) @namespace) +(qualified_variable (module) @namespace) +(import (module) @namespace) [ (where) @@ -66,8 +87,8 @@ "newtype" "family" "type" - "qualified" "as" + "hiding" "deriving" "via" "stock" @@ -77,15 +98,27 @@ "rec" ] @keyword -[ - "(" - ")" - "{" - "}" - "[" - "]" -] @punctuation.bracket -; [ -; "," -; ] @punctuation.delimiter +;; ---------------------------------------------------------------------------- +;; Functions and variables + +(signature name: (variable) @type) +(function name: (variable) @function) + +(variable) @variable +"_" @punctuation.special + +(exp_infix (variable) @operator) ; consider infix functions as operators + +("@" @namespace) ; "as" pattern operator, e.g. x@Constructor + + +;; ---------------------------------------------------------------------------- +;; Types + +(type) @type + +(constructor) @constructor + +; True or False +((constructor) @_bool (#match? @_bool "(True|False)")) @boolean |
