|
| 1 | +;; ---------------------------------------------------------------------------- |
| 2 | +;; Literals and comments |
| 3 | + |
| 4 | +(integer) @number |
| 5 | +(exp_negation) @number |
| 6 | +(exp_literal (float)) @float |
| 7 | +(char) @character |
| 8 | +(string) @string |
| 9 | + |
| 10 | +(con_unit) @symbol ; unit, as in () |
| 11 | + |
| 12 | +(comment) @comment |
| 13 | + |
| 14 | + |
| 15 | +;; ---------------------------------------------------------------------------- |
| 16 | +;; Punctuation |
| 17 | + |
| 18 | +[ |
| 19 | + "(" |
| 20 | + ")" |
| 21 | + "{" |
| 22 | + "}" |
| 23 | + "[" |
| 24 | + "]" |
| 25 | +] @punctuation.bracket |
| 26 | + |
| 27 | +[ |
| 28 | + (comma) |
| 29 | + ";" |
| 30 | +] @punctuation.delimiter |
| 31 | + |
| 32 | + |
| 33 | +;; ---------------------------------------------------------------------------- |
| 34 | +;; Keywords, operators, includes |
| 35 | + |
| 36 | +[ |
| 37 | + "forall" |
| 38 | + "∀" |
| 39 | +] @repeat |
| 40 | + |
| 41 | +(pragma) @constant.macro |
| 42 | + |
| 43 | +[ |
| 44 | + "if" |
| 45 | + "then" |
| 46 | + "else" |
| 47 | + "case" |
| 48 | + "of" |
| 49 | +] @conditional |
| 50 | + |
| 51 | +[ |
| 52 | + "import" |
| 53 | + "qualified" |
| 54 | + "module" |
| 55 | +] @include |
| 56 | + |
| 57 | +[ |
| 58 | + (operator) |
| 59 | + (constructor_operator) |
| 60 | + (type_operator) |
| 61 | + (tycon_arrow) |
| 62 | + (qualified_module) ; grabs the `.` (dot), ex: import System.IO |
| 63 | + (all_names) |
| 64 | + (wildcard) |
| 65 | + "=" |
| 66 | + "|" |
| 67 | + "::" |
| 68 | + "=>" |
| 69 | + "->" |
| 70 | + "<-" |
| 71 | + "\\" |
| 72 | + "`" |
| 73 | + "@" |
| 74 | +] @operator |
| 75 | + |
| 76 | +(module) @namespace |
| 77 | + |
| 78 | +[ |
| 79 | + (where) |
| 80 | + "let" |
| 81 | + "in" |
| 82 | + "class" |
| 83 | + "instance" |
| 84 | + "data" |
| 85 | + "newtype" |
| 86 | + "family" |
| 87 | + "type" |
| 88 | + "as" |
| 89 | + "hiding" |
| 90 | + "deriving" |
| 91 | + "via" |
| 92 | + "stock" |
| 93 | + "anyclass" |
| 94 | + "do" |
| 95 | + "mdo" |
| 96 | + "rec" |
| 97 | + "infix" |
| 98 | + "infixl" |
| 99 | + "infixr" |
| 100 | +] @keyword |
| 101 | + |
| 102 | + |
| 103 | +;; ---------------------------------------------------------------------------- |
| 104 | +;; Functions and variables |
| 105 | + |
| 106 | +(variable) @variable |
| 107 | +(pat_wildcard) @variable |
| 108 | + |
| 109 | +(signature name: (variable) @type) |
| 110 | +(function |
| 111 | + name: (variable) @function |
| 112 | + patterns: (patterns)) |
| 113 | +((signature (fun)) . (function (variable) @function)) |
| 114 | +((signature (context (fun))) . (function (variable) @function)) |
| 115 | +((signature (forall (context (fun)))) . (function (variable) @function)) |
| 116 | + |
| 117 | +(exp_infix (variable) @operator) ; consider infix functions as operators |
| 118 | + |
| 119 | +(exp_infix (exp_name) @function (#set! "priority" 101)) |
| 120 | +(exp_apply . (exp_name (variable) @function)) |
| 121 | +(exp_apply . (exp_name (qualified_variable (variable) @function))) |
| 122 | + |
| 123 | + |
| 124 | +;; ---------------------------------------------------------------------------- |
| 125 | +;; Types |
| 126 | + |
| 127 | +(type) @type |
| 128 | +(type_variable) @type |
| 129 | + |
| 130 | +(constructor) @constructor |
| 131 | + |
| 132 | +; True or False |
| 133 | +((constructor) @_bool (#match? @_bool "(True|False)")) @boolean |
| 134 | + |
| 135 | + |
| 136 | +;; ---------------------------------------------------------------------------- |
| 137 | +;; Quasi-quotes |
| 138 | + |
| 139 | +(quoter) @function |
| 140 | +; Highlighting of quasiquote_body is handled by injections.scm |
0 commit comments