summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Barreteau <cbarrete@users.noreply.github.com>2021-01-28 22:42:07 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2021-01-31 10:44:45 +0100
commit459173e5c7d5e602024bb08eefdb7c5c90ef7328 (patch)
tree00d2bbd15032bc6d53de25b88d097e63b0c45a8b
parent32e39094b928c58b8cfebddfeff453225c32d6a1 (diff)
Add ledger parser, folds and highlights queries
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/ledger/folds.scm3
-rw-r--r--queries/ledger/highlights.scm16
5 files changed, 31 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1ca321da..0f1e343d 100644
--- a/README.md
+++ b/README.md
@@ -153,6 +153,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [json](https://github.com/tree-sitter/tree-sitter-json) (maintained by @steelsojka)
- [x] [julia](https://github.com/tree-sitter/tree-sitter-julia) (maintained by @mroavi, @theHamsta)
- [x] [kotlin](https://github.com/QthCN/tree-sitter-kotlin) (maintained by @tormodatt)
+- [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete)
- [x] [lua](https://github.com/nvim-treesitter/tree-sitter-lua) (maintained by @vigoux)
- [x] [nix](https://github.com/cstrahan/tree-sitter-nix) (maintained by @leo60228)
- [x] [ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu)
diff --git a/lockfile.json b/lockfile.json
index dff3865e..d9dcdd00 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -62,6 +62,9 @@
"kotlin": {
"revision": "b72933c0c0ff25f2de35bb3acabfe6979333187e"
},
+ "ledger": {
+ "revision": "e09aad33e577674cc623672b7b2d48c70eade3d7"
+ },
"lua": {
"revision": "97b757ad3546d68dc1131e6ffb9b1d2a750eea29"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index d0db752b..3099df0f 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -71,6 +71,14 @@ list.rust = {
maintainers = {"@vigoux"},
}
+list.ledger = {
+ install_info = {
+ url = "https://github.com/cbarrete/tree-sitter-ledger",
+ files = { "src/parser.c" }
+ },
+ maintainers = {"@cbarrete"},
+}
+
list.lua = {
install_info = {
url = "https://github.com/nvim-treesitter/tree-sitter-lua",
diff --git a/queries/ledger/folds.scm b/queries/ledger/folds.scm
new file mode 100644
index 00000000..d807fc35
--- /dev/null
+++ b/queries/ledger/folds.scm
@@ -0,0 +1,3 @@
+[
+ (xact)
+] @fold
diff --git a/queries/ledger/highlights.scm b/queries/ledger/highlights.scm
new file mode 100644
index 00000000..ba902006
--- /dev/null
+++ b/queries/ledger/highlights.scm
@@ -0,0 +1,16 @@
+((comment) @comment)
+
+((date) @number)
+((account) @variable)
+((note) @comment)
+((amount_expr) @keyword)
+((quantity) @number)
+((commodity) @string)
+
+"include" @include
+
+[
+ "account"
+ "end"
+ "def"
+] @keyword