highlights.scm

  1;; Copyright 2022 nvim-treesitter
  2;;
  3;; Licensed under the Apache License, Version 2.0 (the "License");
  4;; you may not use this file except in compliance with the License.
  5;; You may obtain a copy of the License at
  6;;
  7;;     http://www.apache.org/licenses/LICENSE-2.0
  8;;
  9;; Unless required by applicable law or agreed to in writing, software
 10;; distributed under the License is distributed on an "AS IS" BASIS,
 11;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12;; See the License for the specific language governing permissions and
 13;; limitations under the License.
 14
 15;; ----------------------------------------------------------------------------
 16;; Literals and comments
 17
 18(integer) @number
 19(exp_negation) @number
 20(exp_literal (number)) @float
 21(char) @string
 22[
 23  (string)
 24  (triple_quote_string)
 25] @string
 26
 27(comment) @comment
 28
 29
 30;; ----------------------------------------------------------------------------
 31;; Punctuation
 32
 33[
 34  "("
 35  ")"
 36  "{"
 37  "}"
 38  "["
 39  "]"
 40] @punctuation.bracket
 41
 42[
 43  (comma)
 44  ";"
 45] @punctuation.delimiter
 46
 47
 48;; ----------------------------------------------------------------------------
 49;; Keywords, operators, includes
 50
 51[
 52  "forall"
 53  "∀"
 54] @keyword
 55
 56;; (pragma) @constant
 57
 58[
 59  "if"
 60  "then"
 61  "else"
 62  "case"
 63  "of"
 64] @keyword
 65
 66[
 67  "import"
 68  "module"
 69] @keyword
 70
 71[
 72  (operator)
 73  (constructor_operator)
 74  (type_operator)
 75  (qualified_module)  ; grabs the `.` (dot), ex: import System.IO
 76  (all_names)
 77  (wildcard)
 78  "="
 79  "|"
 80  "::"
 81  "=>"
 82  "->"
 83  "<-"
 84  "\\"
 85  "`"
 86  "@"
 87  "∷"
 88  "⇒"
 89  "<="
 90  "⇐"
 91  "→"
 92  "←"
 93] @operator
 94
 95(module) @title
 96
 97[
 98  (where)
 99  "let"
100  "in"
101  "class"
102  "instance"
103  "derive"
104  "foreign"
105  "data"
106  "newtype"
107  "type"
108  "as"
109  "hiding"
110  "do"
111  "ado"
112  "infix"
113  "infixl"
114  "infixr"
115] @keyword
116
117
118;; ----------------------------------------------------------------------------
119;; Functions and variables
120
121(variable) @variable
122(pat_wildcard) @variable
123
124(signature name: (variable) @type)
125(function
126  name: (variable) @function
127  patterns: (patterns))
128
129
130(exp_infix (exp_name) @function (#set! "priority" 101))
131(exp_apply . (exp_name (variable) @function))
132(exp_apply . (exp_name (qualified_variable (variable) @function)))
133
134
135;; ----------------------------------------------------------------------------
136;; Types
137
138(type) @type
139(type_variable) @type
140
141(constructor) @constructor
142
143; True or False
144((constructor) @_bool (#match? @_bool "(True|False)")) @boolean