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