From f1c272676b0348c8c0bdf40b2b6a8e4be39e5756 Mon Sep 17 00:00:00 2001 From: Pau Ruiz Safont Date: Mon, 28 Sep 2020 22:59:11 +0100 Subject: [PATCH] feat: add ocamllex parser and highlights --- lua/nvim-treesitter/parsers.lua | 8 ++++++++ queries/ocamllex/highlights.scm | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 queries/ocamllex/highlights.scm 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