summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Beauxis <toots@rastageeks.org>2023-10-04 09:58:10 -0500
committerGitHub <noreply@github.com>2023-10-04 10:58:10 -0400
commit691fdc61a13ecca2f5cf0c2abda4b5da87c54893 (patch)
treeb5edb683047e9d41267f087401c5c8622c488398
parentfix(c): add missing folds (diff)
downloadnvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.tar
nvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.tar.gz
nvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.tar.bz2
nvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.tar.lz
nvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.tar.xz
nvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.tar.zst
nvim-treesitter-691fdc61a13ecca2f5cf0c2abda4b5da87c54893.zip
feat: add liquidsoap
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/liquidsoap/folds.scm21
-rw-r--r--queries/liquidsoap/highlights.scm85
-rw-r--r--queries/liquidsoap/indents.scm54
-rw-r--r--queries/liquidsoap/locals.scm15
7 files changed, 187 insertions, 0 deletions
diff --git a/README.md b/README.md
index 50a72798f..b86a54f54 100644
--- a/README.md
+++ b/README.md
@@ -280,6 +280,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason)
- [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete)
- [x] [llvm](https://github.com/benwilliamgraham/tree-sitter-llvm) (maintained by @benwilliamgraham)
+- [x] [liquidsoap](https://github.com/savonet/tree-sitter-liquidsoap) (maintained by @toots)
- [x] [lua](https://github.com/MunifTanjim/tree-sitter-lua) (maintained by @muniftanjim)
- [x] [luadoc](https://github.com/amaanq/tree-sitter-luadoc) (maintained by @amaanq)
- [x] [lua patterns](https://github.com/amaanq/tree-sitter-luap) (maintained by @amaanq)
diff --git a/lockfile.json b/lockfile.json
index e01e02921..41845a314 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -320,6 +320,9 @@
"llvm": {
"revision": "1b96e58faf558ce057d4dc664b904528aee743cb"
},
+ "liquidsoap": {
+ "revision": "bfc9518d4289c1e0477f0c99cf37c84d895ef8e8"
+ },
"lua": {
"revision": "9668709211b2e683f27f414454a8b51bf0a6bda1"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index ee6ad3295..26a2bf8f5 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -975,6 +975,14 @@ list.llvm = {
maintainers = { "@benwilliamgraham" },
}
+list.liquidsoap = {
+ install_info = {
+ url = "https://github.com/savonet/tree-sitter-liquidsoap",
+ files = { "src/parser.c", "src/scanner.cc" },
+ },
+ maintainers = { "@toots" },
+}
+
list.lua = {
install_info = {
url = "https://github.com/MunifTanjim/tree-sitter-lua",
diff --git a/queries/liquidsoap/folds.scm b/queries/liquidsoap/folds.scm
new file mode 100644
index 000000000..9b0d12efa
--- /dev/null
+++ b/queries/liquidsoap/folds.scm
@@ -0,0 +1,21 @@
+[
+ (let)
+ (binding)
+ (simple_fun)
+ (def)
+ (arglist)
+ (if)
+ (if_condition)
+ (if_then)
+ (elsif_condition)
+ (elsif_then)
+ (if_else)
+ (for)
+ (for_do)
+ (while)
+ (while_do)
+ (try)
+ (try_body)
+ (try_do)
+ (block)
+] @fold
diff --git a/queries/liquidsoap/highlights.scm b/queries/liquidsoap/highlights.scm
new file mode 100644
index 000000000..fcf553e3b
--- /dev/null
+++ b/queries/liquidsoap/highlights.scm
@@ -0,0 +1,85 @@
+(var) @variable
+
+(op) @operator
+["and" "or" "not"] @keyword.operator
+
+[
+ "def"
+ "fun"
+ "def_end"
+] @keyword.function
+
+(let_decoration) @keyword.coroutine
+
+[
+ "open"
+ "begin"
+ "block_end"
+ "let"
+] @keyword
+
+[
+ "while"
+ "do"
+ "to"
+ "for"
+ "for_end"
+ "while_end"
+] @repeat
+
+[
+ "if"
+ "then"
+ "elsif"
+ "else"
+ "if_end"
+] @conditional
+
+[
+ "try"
+ "catch"
+ "try_end"
+] @exception
+
+(inline_if [ "?" ":" ] @conditional.ternary)
+
+[
+ "%ifdef"
+ "%ifndef"
+ "%ifencoder"
+ "%ifnencoder"
+ "%ifversion"
+ "%else"
+ "%endif"
+ "%argsof"
+ "%include"
+] @preproc
+
+(encoder_name) @constant.builtin
+
+(anonymous_argument (var) @parameter)
+(labeled_argument label: (var) @parameter)
+
+"." @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+(app name: (var) @function.call)
+(method) @method
+(method_app) @method.call
+
+(string) @string
+(string_interpolation [ "#{" "}" ] @punctuation.special)
+(integer) @number
+(float) @float
+(bool) @boolean
+(comment) @comment
+(regexp) @string.regex
+(type) @type
diff --git a/queries/liquidsoap/indents.scm b/queries/liquidsoap/indents.scm
new file mode 100644
index 000000000..ce8c02b53
--- /dev/null
+++ b/queries/liquidsoap/indents.scm
@@ -0,0 +1,54 @@
+[
+ "%ifdef"
+ "%ifndef"
+ "%ifencoder"
+ "%ifnencoder"
+ "%ifversion"
+ "%else"
+ "%endif"
+ "%argsof"
+ "%include"
+] @indent.zero
+
+[
+ "if"
+ "def"
+ "let"
+ "for"
+ "while"
+ "try"
+ "{"
+ "["
+ "("
+] @indent.begin
+
+(ERROR "def") @indent.begin
+
+(def "def_end" @indent.end)
+(if "if_end" @indent.end)
+(block "block_end" @indent.end)
+(for "for_end" @indent.end)
+(while "while_end" @indent.end)
+(try "try_end" @indent.end)
+
+[
+ "then"
+ "do"
+ "else"
+ "elsif"
+ "catch"
+] @indent.branch
+
+[
+ "def_end"
+ "if_end"
+ "block_end"
+ "for_end"
+ "while_end"
+ "try_end"
+ "}"
+ "]"
+ ")"
+] @indent.branch @indent.end
+
+(comment) @indent.auto
diff --git a/queries/liquidsoap/locals.scm b/queries/liquidsoap/locals.scm
new file mode 100644
index 000000000..1d67bc55a
--- /dev/null
+++ b/queries/liquidsoap/locals.scm
@@ -0,0 +1,15 @@
+[(anonymous_function) (binding) (def) (let)] @scope
+
+(anonymous_argument (var) @definition.parameter)
+(labeled_argument label: (var) @definition.parameter)
+
+(binding
+ defined: (var) @definition.var)
+(def defined: (var) @definition.var)
+(let defined: (var) @definition.var)
+(meth_pattern (var) @definition.var)
+(list_pattern (var) @definition.var)
+(tuple_pattern (var) @definition.var)
+(spread (var) @definition.var)
+
+(var) @reference