aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Pépin <kerl@wkerl.me>2022-09-01 19:36:23 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-09-05 14:48:58 -0700
commit82036f8db8d539653cb8a5ef5a6a1a9f7d735555 (patch)
treef0ea5f3fed49ad6acd6766d02657b687b6bd672f
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.tar
nvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.tar.gz
nvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.tar.bz2
nvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.tar.lz
nvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.tar.xz
nvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.tar.zst
nvim-treesitter-82036f8db8d539653cb8a5ef5a6a1a9f7d735555.zip
Add support for menhir (OCaml parser generator)
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/menhir/highlights.scm29
-rw-r--r--queries/menhir/injections.scm1
4 files changed, 42 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json
index 91bfe6754..b6f1f32b9 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -227,6 +227,9 @@
"ocamllex": {
"revision": "ac1d5957e719d49bd6acd27439b79843e4daf8ed"
},
+ "menhir": {
+ "revision": "db7953acb0d5551f207373c81fa07a57d7b085cb"
+ },
"org": {
"revision": "698bb1a34331e68f83fc24bdd1b6f97016bb30de"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 70679ca1c..b136b2096 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -471,6 +471,15 @@ list.ocamllex = {
maintainers = { "@undu" },
}
+list.menhir = {
+ install_info = {
+ url = "https://github.com/Kerl13/tree-sitter-menhir",
+ files = { "src/parser.c", "src/scanner.cc" },
+ },
+ maintainers = { "@Kerl13" },
+ filetype = "menhir",
+}
+
list.org = {
install_info = {
url = "https://github.com/milisims/tree-sitter-org",
diff --git a/queries/menhir/highlights.scm b/queries/menhir/highlights.scm
new file mode 100644
index 000000000..64789ee49
--- /dev/null
+++ b/queries/menhir/highlights.scm
@@ -0,0 +1,29 @@
+["%parameter" "%token" "%type" "%start" "%attribute" "%left" "%right" "%nonassoc" "%public" "%inline" "%prec"] @keyword
+["%on_error_reduce"] @exception
+
+["let"] @keyword.function
+
+[(equality_symbol) ":" "|" ";" ","] @punctuation.delimiter
+
+["=" "~" "_"] @operator
+(modifier) @operator
+
+["<" ">" "{" "}" "%{" "%}" "%%"] @punctuation.special
+
+["(" ")"] @punctuation.bracket
+
+(old_rule [(symbol)] @function)
+(new_rule [(lid)] @function)
+
+(precedence [(symbol)] @parameter)
+
+(funcall) @function.call
+
+; Not very accurant but does a decent job
+(uid) @constant
+
+(ocaml_type) @type
+(ocaml) @none
+
+[(comment) (line_comment) (ocaml_comment)] @comment
+(ERROR) @error
diff --git a/queries/menhir/injections.scm b/queries/menhir/injections.scm
new file mode 100644
index 000000000..7a31dd50c
--- /dev/null
+++ b/queries/menhir/injections.scm
@@ -0,0 +1 @@
+(ocaml) @ocaml