;; Copyright 2022 nvim-treesitter ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License. ;; You may obtain a copy of the License at ;; ;; http://www.apache.org/licenses/LICENSE-2.0 ;; ;; Unless required by applicable law or agreed to in writing, software ;; distributed under the License is distributed on an "AS IS" BASIS, ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ;; See the License for the specific language governing permissions and ;; limitations under the License. ;; ---------------------------------------------------------------------------- ;; Literals and comments (integer) @number (exp_negation) @number (exp_literal (float)) @float (char) @character (string) @string (con_unit) @symbol ; unit, as in () (comment) @comment ;; ---------------------------------------------------------------------------- ;; Punctuation [ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket [ (comma) ";" ] @punctuation.delimiter ;; ---------------------------------------------------------------------------- ;; Keywords, operators, includes [ "forall" "∀" ] @repeat (pragma) @constant.macro [ "if" "then" "else" "case" "of" ] @conditional (exp_lambda_cases "\\" ("cases" @conditional)) [ "import" "qualified" "module" ] @include [ (operator) (constructor_operator) (type_operator) (tycon_arrow) (qualified_module) ; grabs the `.` (dot), ex: import System.IO (all_names) (wildcard) "=" "|" "::" "=>" "->" "<-" "\\" "`" "@" ] @operator (module) @namespace [ (where) "let" "in" "class" "instance" "data" "newtype" "family" "type" "as" "hiding" "deriving" "via" "stock" "anyclass" "do" "mdo" "rec" "infix" "infixl" "infixr" ] @keyword ;; ---------------------------------------------------------------------------- ;; Functions and variables (variable) @variable (pat_wildcard) @variable (signature name: (variable) @type) (function name: (variable) @function patterns: (patterns)) ((signature (fun)) . (function (variable) @function)) ((signature (context (fun))) . (function (variable) @function)) ((signature (forall (context (fun)))) . (function (variable) @function)) (exp_infix (variable) @operator) ; consider infix functions as operators (exp_infix (exp_name) @function (#set! "priority" 101)) (exp_apply . (exp_name (variable) @function)) (exp_apply . (exp_name (qualified_variable (variable) @function))) ;; ---------------------------------------------------------------------------- ;; Types (type) @type (type_variable) @type (constructor) @constructor ; True or False ((constructor) @_bool (#match? @_bool "(True|False)")) @boolean ;; ---------------------------------------------------------------------------- ;; Quasi-quotes (quoter) @function ; Highlighting of quasiquote_body is handled by injections.scm