aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Sandven <tomas@sandven.email>2021-07-19 07:44:03 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-07-19 16:03:27 +0000
commita6121f014d2e75bd9eab23082d0f6e02b46ae092 (patch)
treebd460f25280ec4722a3402a2796d263035a714a6
parentUse terraform ft for tf and tfvars (diff)
downloadnvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.tar
nvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.tar.gz
nvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.tar.bz2
nvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.tar.lz
nvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.tar.xz
nvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.tar.zst
nvim-treesitter-a6121f014d2e75bd9eab23082d0f6e02b46ae092.zip
Add YANG parser
-rw-r--r--README.md1
-rw-r--r--ftdetect/yang.vim1
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/yang/highlights.scm29
4 files changed, 40 insertions, 0 deletions
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)
<!--parserinfo-->
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