2022-01-05 21:53:37 +04:00
|
|
|
;; ----------------------------------------------------------------------------
|
|
|
|
;; Literals and comments
|
|
|
|
|
2021-11-03 07:00:52 +04:00
|
|
|
(integer) @constant.numeric.integer
|
2022-01-05 21:53:37 +04:00
|
|
|
(exp_negation) @constant.numeric.integer
|
2021-11-03 07:00:52 +04:00
|
|
|
(exp_literal (float)) @constant.numeric.float
|
|
|
|
(char) @constant.character
|
2022-01-05 21:53:37 +04:00
|
|
|
(string) @string
|
|
|
|
|
|
|
|
(con_unit) @constant.builtin ; unit, as in ()
|
|
|
|
|
|
|
|
(comment) @comment
|
|
|
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------------------
|
|
|
|
;; Punctuation
|
|
|
|
|
2021-09-06 09:33:02 +04:00
|
|
|
[
|
|
|
|
"("
|
|
|
|
")"
|
2022-01-05 21:53:37 +04:00
|
|
|
"{"
|
|
|
|
"}"
|
|
|
|
"["
|
|
|
|
"]"
|
2021-09-06 09:33:02 +04:00
|
|
|
] @punctuation.bracket
|
2022-01-05 21:53:37 +04:00
|
|
|
|
|
|
|
[
|
|
|
|
(comma)
|
|
|
|
";"
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------------------
|
|
|
|
;; Keywords, operators, includes
|
|
|
|
|
2023-10-17 14:19:57 +04:00
|
|
|
[
|
|
|
|
"forall"
|
|
|
|
"∀"
|
|
|
|
] @keyword.control.repeat
|
|
|
|
|
2022-01-05 21:53:37 +04:00
|
|
|
(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
|
|
|
|
|
2023-10-17 14:19:57 +04:00
|
|
|
(module) @namespace
|
2022-01-05 21:53:37 +04:00
|
|
|
|
|
|
|
[
|
|
|
|
(where)
|
|
|
|
"let"
|
|
|
|
"in"
|
|
|
|
"class"
|
|
|
|
"instance"
|
|
|
|
"data"
|
|
|
|
"newtype"
|
|
|
|
"family"
|
|
|
|
"type"
|
|
|
|
"as"
|
|
|
|
"hiding"
|
|
|
|
"deriving"
|
|
|
|
"via"
|
|
|
|
"stock"
|
|
|
|
"anyclass"
|
|
|
|
"do"
|
|
|
|
"mdo"
|
|
|
|
"rec"
|
2022-01-07 01:05:29 +04:00
|
|
|
"infix"
|
|
|
|
"infixl"
|
|
|
|
"infixr"
|
2022-01-05 21:53:37 +04:00
|
|
|
] @keyword
|
|
|
|
|
|
|
|
|
|
|
|
;; ----------------------------------------------------------------------------
|
|
|
|
;; Functions and variables
|
|
|
|
|
|
|
|
(signature name: (variable) @type)
|
2023-10-17 14:19:57 +04:00
|
|
|
(function
|
|
|
|
name: (variable) @function
|
|
|
|
patterns: (patterns))
|
|
|
|
((signature (fun)) . (function (variable) @function))
|
|
|
|
((signature (context (fun))) . (function (variable) @function))
|
|
|
|
((signature (forall (context (fun)))) . (function (variable) @function))
|
2022-01-05 21:53:37 +04:00
|
|
|
|
|
|
|
(exp_infix (variable) @operator) ; consider infix functions as operators
|
|
|
|
|
2023-10-17 14:19:57 +04:00
|
|
|
(exp_infix (exp_name) @function)
|
|
|
|
(exp_apply . (exp_name (variable) @function))
|
|
|
|
(exp_apply . (exp_name (qualified_variable (variable) @function)))
|
2022-01-05 21:53:37 +04:00
|
|
|
|
2023-10-17 14:19:57 +04:00
|
|
|
(variable) @variable
|
|
|
|
(pat_wildcard) @variable
|
2022-01-05 21:53:37 +04:00
|
|
|
|
|
|
|
;; ----------------------------------------------------------------------------
|
|
|
|
;; Types
|
|
|
|
|
|
|
|
(type) @type
|
2023-11-06 05:54:25 +04:00
|
|
|
(type_variable) @type.parameter
|
2022-01-05 21:53:37 +04:00
|
|
|
|
|
|
|
(constructor) @constructor
|
|
|
|
|
|
|
|
; True or False
|
|
|
|
((constructor) @_bool (#match? @_bool "(True|False)")) @constant.builtin.boolean
|
2023-10-17 14:19:57 +04:00
|
|
|
|
|
|
|
;; ----------------------------------------------------------------------------
|
|
|
|
;; Quasi-quotes
|
|
|
|
|
|
|
|
(quoter) @function
|
|
|
|
; Highlighting of quasiquote_body is handled by injections.scm
|