From 459173e5c7d5e602024bb08eefdb7c5c90ef7328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Barreteau?= Date: Thu, 28 Jan 2021 22:42:07 +0100 Subject: Add ledger parser, folds and highlights queries --- README.md | 1 + lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 8 ++++++++ queries/ledger/folds.scm | 3 +++ queries/ledger/highlights.scm | 16 ++++++++++++++++ 5 files changed, 31 insertions(+) create mode 100644 queries/ledger/folds.scm create mode 100644 queries/ledger/highlights.scm 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 -- cgit v1.2.3