mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -04:00
Add ninja parser (#2217)
* Add ninja parser * Add branch main * No need for ftdetect
This commit is contained in:
parent
c090007a88
commit
a7c0c1764b
5 changed files with 115 additions and 0 deletions
|
|
@ -208,6 +208,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [lua](https://github.com/nvim-treesitter/tree-sitter-lua) (maintained by @vigoux)
|
- [x] [lua](https://github.com/nvim-treesitter/tree-sitter-lua) (maintained by @vigoux)
|
||||||
- [x] [make](https://github.com/alemuller/tree-sitter-make) (maintained by @lewis6991)
|
- [x] [make](https://github.com/alemuller/tree-sitter-make) (maintained by @lewis6991)
|
||||||
- [ ] [markdown](https://github.com/MDeiml/tree-sitter-markdown)
|
- [ ] [markdown](https://github.com/MDeiml/tree-sitter-markdown)
|
||||||
|
- [x] [ninja](https://github.com/alemuller/tree-sitter-ninja) (maintained by @alemuller)
|
||||||
- [x] [nix](https://github.com/cstrahan/tree-sitter-nix) (maintained by @leo60228)
|
- [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)
|
- [x] [ocaml](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu)
|
||||||
- [x] [ocaml_interface](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu)
|
- [x] [ocaml_interface](https://github.com/tree-sitter/tree-sitter-ocaml) (maintained by @undu)
|
||||||
|
|
|
||||||
|
|
@ -532,6 +532,15 @@ list.yang = {
|
||||||
filetype = "yang",
|
filetype = "yang",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.ninja = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/alemuller/tree-sitter-ninja",
|
||||||
|
files = { "src/parser.c" },
|
||||||
|
branch = "main",
|
||||||
|
},
|
||||||
|
maintainers = { "@alemuller" },
|
||||||
|
}
|
||||||
|
|
||||||
list.nix = {
|
list.nix = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/cstrahan/tree-sitter-nix",
|
url = "https://github.com/cstrahan/tree-sitter-nix",
|
||||||
|
|
|
||||||
1
queries/ninja/folds.scm
Normal file
1
queries/ninja/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
(body) @fold
|
||||||
98
queries/ninja/highlights.scm
Normal file
98
queries/ninja/highlights.scm
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
[
|
||||||
|
"default"
|
||||||
|
"pool"
|
||||||
|
"rule"
|
||||||
|
"build"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"include"
|
||||||
|
"subninja"
|
||||||
|
] @include
|
||||||
|
|
||||||
|
[
|
||||||
|
":"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"|"
|
||||||
|
"||"
|
||||||
|
"|@"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"$"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Names
|
||||||
|
;; =====
|
||||||
|
(pool name: (identifier) @type)
|
||||||
|
(rule name: (identifier) @function)
|
||||||
|
(let name: (identifier) @constant)
|
||||||
|
(expansion (identifier) @constant)
|
||||||
|
(build rule: (identifier) @function)
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Paths and Text
|
||||||
|
;; ==============
|
||||||
|
(path) @string.special
|
||||||
|
(text) @string
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Builtins
|
||||||
|
;; ========
|
||||||
|
(pool name: (identifier) @type.builtin
|
||||||
|
(#any-of? @type.builtin "console"))
|
||||||
|
(build rule: (identifier) @function.builtin
|
||||||
|
(#any-of? @function.builtin "phony" "dyndep"))
|
||||||
|
|
||||||
|
;; Top level bindings
|
||||||
|
;; ------------------
|
||||||
|
(manifest
|
||||||
|
(let name: ((identifier) @constant.builtin
|
||||||
|
(#any-of? @constant.builtin "builddir"
|
||||||
|
"ninja_required_version"))))
|
||||||
|
|
||||||
|
;; Rules bindings
|
||||||
|
;; -----------------
|
||||||
|
(rule
|
||||||
|
(body
|
||||||
|
(let name: (identifier) @constant.builtin
|
||||||
|
(#not-any-of? @constant.builtin "command"
|
||||||
|
"depfile"
|
||||||
|
"deps"
|
||||||
|
"msvc_deps_prefix"
|
||||||
|
"description"
|
||||||
|
"dyndep"
|
||||||
|
"generator"
|
||||||
|
"in"
|
||||||
|
"in_newline"
|
||||||
|
"out"
|
||||||
|
"restat"
|
||||||
|
"rspfile"
|
||||||
|
"rspfile_content"
|
||||||
|
"pool"))))
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Expansion
|
||||||
|
;; ---------
|
||||||
|
(expansion
|
||||||
|
(identifier) @constant.macro
|
||||||
|
(#any-of? @constant.macro "in" "out"))
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Escape sequences
|
||||||
|
;; ================
|
||||||
|
(quote) @string.escape
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Others
|
||||||
|
;; ======
|
||||||
|
[
|
||||||
|
(split)
|
||||||
|
(comment)
|
||||||
|
] @comment
|
||||||
6
queries/ninja/indents.scm
Normal file
6
queries/ninja/indents.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[
|
||||||
|
(pool)
|
||||||
|
(rule)
|
||||||
|
(build)
|
||||||
|
] @indent
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue