From a6121f014d2e75bd9eab23082d0f6e02b46ae092 Mon Sep 17 00:00:00 2001 From: Tomas Sandven Date: Mon, 19 Jul 2021 07:44:03 +0200 Subject: Add YANG parser --- README.md | 1 + ftdetect/yang.vim | 1 + lua/nvim-treesitter/parsers.lua | 9 +++++++++ queries/yang/highlights.scm | 29 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 ftdetect/yang.vim create mode 100644 queries/yang/highlights.scm diff --git a/README.md b/README.md index 937c4cc01..4ef2e9777 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (maintained by @zegervdv) - [x] [vue](https://github.com/ikatyang/tree-sitter-vue) (maintained by @WhyNotHugo) - [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd) +- [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro) - [x] [zig](https://github.com/Himujjal/tree-sitter-zig) (maintained by @Himujjal) diff --git a/ftdetect/yang.vim b/ftdetect/yang.vim new file mode 100644 index 000000000..295e7c3d3 --- /dev/null +++ b/ftdetect/yang.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.yang set filetype=yang diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ae8e7a2e8..0739d01b7 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -424,6 +424,15 @@ list.yaml = { maintainers = { "@stsewd" }, } +list.yang = { + install_info = { + url = "https://github.com/Hubro/tree-sitter-yang", + files = { "src/parser.c" }, + }, + maintainers = { "@Hubro" }, + filetype = "yang", +} + list.nix = { install_info = { url = "https://github.com/cstrahan/tree-sitter-nix", diff --git a/queries/yang/highlights.scm b/queries/yang/highlights.scm new file mode 100644 index 000000000..82ae8d5bd --- /dev/null +++ b/queries/yang/highlights.scm @@ -0,0 +1,29 @@ + +(comment) @comment + +; Module / submodule +["module" "submodule"] @keyword + +; Keywords +(statement_keyword) @keyword +(extension_keyword) @string.escape + +; Arguments +(built_in_type) @type.builtin +(integer) @number +(boolean) @boolean +(date) @number +(range) @string.escape +(unquoted_range) @string.escape +(yang_version) @string.escape +(identifier) @variable +(node_identifier) @variable +(glob) @string +(string) @string +(unquoted_string) @string +(keypath) @string.escape + +; Punctuation +(plus_symbol) @punctuation.delimiter +["{" "}"] @punctuation.bracket +[";"] @punctuation.delimiter -- cgit v1.2.3-70-g09d2