highlights.scm

  1; Modules
  2;--------
  3
  4[(module_name) (module_type_name)] @title
  5
  6; Types
  7;------
  8
  9[(class_name) (class_type_name) (type_constructor)] @type
 10
 11(tag) @variant ;; Polymorphic Variants
 12(constructor_name) @constructor ;; Exceptions, variants and the like
 13
 14; Functions
 15;----------
 16
 17(let_binding
 18  pattern: (value_name) @function
 19  (parameter))
 20
 21(let_binding
 22  pattern: (value_name) @function
 23  body: [(fun_expression) (function_expression)])
 24
 25(value_specification (value_name) @function)
 26
 27(external (value_name) @function)
 28
 29(method_name) @function
 30
 31(infix_expression
 32  left: (value_path (value_name) @function)
 33  operator: (concat_operator) @operator
 34  (#eq? @operator "@@"))
 35
 36(infix_expression
 37  operator: (rel_operator) @operator
 38  right: (value_path (value_name) @function)
 39  (#eq? @operator "|>"))
 40
 41(application_expression
 42  function: (value_path (value_name) @function))
 43
 44; Variables
 45;----------
 46
 47[(type_variable) (value_pattern)] @variable
 48
 49; Properties
 50;-----------
 51
 52[(label_name) (field_name) (instance_variable_name)] @property
 53
 54; Constants
 55;----------
 56
 57(boolean) @boolean
 58
 59[(number) (signed_number)] @number
 60
 61[(string) (character)] @string
 62
 63(quoted_string "{" @string "}" @string) @string
 64(quoted_string_content) @string
 65
 66
 67(escape_sequence) @string.escape
 68
 69[
 70  (conversion_specification)
 71  (pretty_printing_indication)
 72] @punctuation.special
 73
 74; Operators
 75;----------
 76
 77(match_expression (match_operator) @keyword)
 78
 79(value_definition [(let_operator) (let_and_operator)] @keyword)
 80
 81[
 82  (prefix_operator)
 83  (sign_operator)
 84  (pow_operator)
 85  (mult_operator)
 86  (add_operator)
 87  (concat_operator)
 88  (rel_operator)
 89  (and_operator)
 90  (or_operator)
 91  (assign_operator)
 92  (hash_operator)
 93  (indexing_operator)
 94  (let_operator)
 95  (let_and_operator)
 96  (match_operator)
 97] @operator
 98
 99["*" "#" "::" "<-"] @operator
100
101; Keywords
102;---------
103
104[
105  "and" "as" "assert" "begin" "class" "constraint" "do" "done" "downto" "else"
106  "end" "exception" "external" "for" "fun" "function" "functor" "if" "in"
107  "include" "inherit" "initializer" "lazy" "let" "match" "method" "module"
108  "mutable" "new" "nonrec" "object" "of" "open" "private" "rec" "sig" "struct"
109  "then" "to" "try" "type" "val" "virtual" "when" "while" "with"
110] @keyword
111
112; Punctuation
113;------------
114
115["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket
116
117(object_type ["<" ">"] @punctuation.bracket)
118
119[
120  "," "." ";" ":" "=" "|" "~" "?" "+" "-" "!" ">" "&"
121  "->" ";;" ":>" "+=" ":=" ".."
122] @punctuation.delimiter
123
124; Attributes
125;-----------
126
127[
128  (attribute)
129  (item_attribute)
130  (floating_attribute)
131  (extension)
132  (item_extension)
133  (quoted_extension)
134  (quoted_item_extension) 
135  "%"
136] @attribute
137
138(attribute_id) @tag
139
140; Comments
141;---------
142
143[(comment) (line_number_directive) (directive) (shebang)] @comment