diff options
author | Owen Shepherd | 2022-01-05 17:53:37 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-01-08 15:28:56 +0000 |
commit | 9eacbc1887fd102a820c40add24f3a1cd2d994ed (patch) | |
tree | 6f8b3e2246f4e9f3283a9cfbae24b047c304de10 /runtime | |
parent | 41ee45ce5498a070b782abe22dfdc33b5e372964 (diff) |
Upgrade haskell queries
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queries/haskell/highlights.scm | 153 |
1 files changed, 115 insertions, 38 deletions
diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index 8006cb07..3f5d6de5 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -1,45 +1,122 @@ -(variable) @variable -(operator) @operator -(exp_name (constructor) @constructor) -(constructor_operator) @operator -(module) @namespace -(type) @type -(type) @class -(constructor) @constructor -(pragma) @pragma -(comment) @comment -(signature name: (variable) @type) -(function name: (variable) @function) -(constraint class: (class_name (type)) @class) -(class (class_head class: (class_name (type)) @class)) -(instance (instance_head class: (class_name (type)) @class)) +;; ---------------------------------------------------------------------------- +;; Literals and comments + (integer) @constant.numeric.integer +(exp_negation) @constant.numeric.integer (exp_literal (float)) @constant.numeric.float (char) @constant.character -(con_unit) @literal -(con_list) @literal -(tycon_arrow) @operator -(where) @keyword -"module" @keyword -"let" @keyword -"in" @keyword -"class" @keyword -"instance" @keyword -"data" @keyword -"newtype" @keyword -"family" @keyword -"type" @keyword -"import" @keyword -"qualified" @keyword -"as" @keyword -"deriving" @keyword -"via" @keyword -"stock" @keyword -"anyclass" @keyword -"do" @keyword -"mdo" @keyword -"rec" @keyword +(string) @string + +(con_unit) @constant.builtin ; unit, as in () + +(comment) @comment + + +;; ---------------------------------------------------------------------------- +;; Punctuation + [ "(" ")" + "{" + "}" + "[" + "]" ] @punctuation.bracket + +[ + (comma) + ";" +] @punctuation.delimiter + + +;; ---------------------------------------------------------------------------- +;; Keywords, operators, includes + +(pragma) @constant.macro + +[ + "if" + "then" + "else" + "case" + "of" +] @keyword.control.conditional + +[ + "import" + "qualified" + "module" +] @keyword.control.import + +[ + (operator) + (constructor_operator) + (type_operator) + (tycon_arrow) + (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (all_names) + (wildcard) + "=" + "|" + "::" + "=>" + "->" + "<-" + "\\" + "`" + "@" +] @operator + +(qualified_module (module) @constructor) +(qualified_type (module) @namespace) +(qualified_variable (module) @namespace) +(import (module) @namespace) + +[ + (where) + "let" + "in" + "class" + "instance" + "data" + "newtype" + "family" + "type" + "as" + "hiding" + "deriving" + "via" + "stock" + "anyclass" + "do" + "mdo" + "rec" + "forall" + "∀" +] @keyword + + +;; ---------------------------------------------------------------------------- +;; Functions and variables + +(signature name: (variable) @type) +(function name: (variable) @function) + +(variable) @variable +"_" @variable.builtin + +(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)")) @constant.builtin.boolean |