diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 6b74faaa8..f0177e3e7 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -145,6 +145,14 @@ list.ocaml_interface = { filetype = 'ocamlinterface' } +list.ocamllex = { + install_info = { + url = "https://github.com/atom-ocaml/tree-sitter-ocamllex", + files = { "src/parser.c", "src/scanner.cc" }, + }, + maintainers = {'@undu'}, +} + list.swift = { install_info = { url = "https://github.com/tree-sitter/tree-sitter-swift", diff --git a/queries/ocamllex/highlights.scm b/queries/ocamllex/highlights.scm new file mode 100644 index 000000000..eb72102a7 --- /dev/null +++ b/queries/ocamllex/highlights.scm @@ -0,0 +1,27 @@ + +[(lexer_argument) (regexp_name) (any)] @type + +(lexer_entry_name) @function + +["as" "let" "parse" "rule"] @keyword + +[(eof) (character)] @character +(string) @string + +(character_range "-" @operator) +(character_set "^" @operator) +(regexp_alternative ["|"] @operator) +(regexp_difference ["#"] @operator) +(regexp_option ["?"] @operator) +(regexp_repetition ["*"] @operator) +(regexp_strict_repetition ["+"] @operator) + +(action ["{" "}"] @punctuation.special) @embedded +(character_set ["[" "]"] @punctuation.bracket) +(parenthesized_regexp ["(" ")"] @punctuation.bracket) + +["="] @punctuation.delimiter +(lexer_entry "|" @punctuation.delimiter) + +(comment) @comment +(ERROR) @error