diff options
| author | Pau Ruiz Safont <unduthegun@gmail.com> | 2020-08-16 22:37:02 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-08-24 10:16:38 +0200 |
| commit | 3fe5a067b3deb98e7554c94b2ac6160e99d9c186 (patch) | |
| tree | a03ccf7b3794089a53813d611e5d796623e0657d | |
| parent | feat(c/cpp highlights): highlight pointer/reference parameters (diff) | |
| download | nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.tar nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.tar.gz nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.tar.bz2 nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.tar.lz nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.tar.xz nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.tar.zst nvim-treesitter-3fe5a067b3deb98e7554c94b2ac6160e99d9c186.zip | |
feat(highlights): add ocaml
| -rw-r--r-- | queries/ocaml/hightlights.scm | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/queries/ocaml/hightlights.scm b/queries/ocaml/hightlights.scm new file mode 100644 index 000000000..7c4ba08d5 --- /dev/null +++ b/queries/ocaml/hightlights.scm @@ -0,0 +1,147 @@ +(module_name) @structure + +[ + (module_type_name) + (type_constructor) + (type_variable) + (constructor_name) + (tag) +] @type +(type_binding (type_constructor) @type) + +(exception_definition (constructor_declaration (constructor_name) @exception)) +(application_expression (value_path (value_name) @_raise) + (#eq? @_raise "raise") + (constructor_path) @exception) +(application_expression (value_path (value_name) @_raise) + (#eq? @_raise "raise") + (parenthesized_expression + (application_expression (constructor_path) @exception))) +(infix_expression (value_path (value_name) @_raise) + (#eq? @_raise "raise") + (application_expression (constructor_path) @exception)) + +(attribute_id) @property +(field_name) @field + +(let_binding + (value_name) @function + (parameter)) +(let_binding + (value_name) @function + (function_expression)) + +(application_expression . (value_path (value_name) @function)) +(application_expression . (value_path (value_path (value_name) @function))) +(application_expression . (value_path (value_path (value_path (value_name) @function)))) +(value_specification (value_name) @function (function_type)) +(infix_expression (value_path (value_name) @function) + (infix_operator) @operator + (#eq? @operator "@@")) +(infix_expression (value_path (value_path (value_name) @function)) + (infix_operator) @operator + (#eq? @operator "@@")) +(infix_expression (value_path (value_path (value_path (value_name) @function))) + (infix_operator) @operator + (#eq? @operator "@@")) +(infix_expression (infix_operator) @operator + (#eq? @operator "|>") + (value_path (value_name) @function)) +(infix_expression (infix_operator) @operator + (#eq? @operator "|>") + (value_path (value_path (value_name) @function))) +(infix_expression (infix_operator) @operator + (#eq? @operator "|>") + (value_path (value_path (value_path (value_name) @function)))) + + +(let_binding (parameter (label (label_name) @parameter))) +(let_binding (parameter (label_name) @parameter)) +(let_binding (parameter (value_name) @parameter)) +(let_binding (parameter (typed_pattern (value_name) @parameter))) +(function_type (typed_label (label_name) @parameter)) + +;; Literals +(unit) @constant +(boolean) @boolean +(number) @number +(character) @character + +(comment) @comment + +[(string) (quoted_string)] @string +(escape_sequence) @string.escape +(conversion_specification) @string.special + +(infix_operator) @operator + +[ + (let_operator) + (and_operator) + "let" + "rec" + "nonrec" + "of" + "in" + "type" + "val" + "and" + "struct" + "sig" + "functor" + "external" + "module" + "match" + "with" + "when" + "begin" + "end" + "fun" + "function" + "assert" + "lazy" + "as" + "method" + "new" + "object" + "inherit" + "mutable" + "virtual" + "private" + "constraint" + "initializer" + "class" +] @keyword + +["exception" "try"] @exception + +["open" "include"] @include + +["if" "then" "else"] @conditional + +["for" "to" "downto" "while" "do" "done"] @repeat + +["(" ")" "[" "]" "{" "}" "[|" "|]" "[<" "[>"] @punctuation.bracket + +[ + "," + "." + ";" + "#" + ":" + "=" + "|" + "->" + "::" + "~" + "?" + "|" + "+" + "-" + "*" + "'" + ";;" + ":>" +] @punctuation.delimiter + +(ERROR) @error |
