feat: add Kconfig

This commit is contained in:
Amaan Qureshi 2023-08-31 05:28:16 -04:00
parent 8e9cc89955
commit f8c2825220
8 changed files with 132 additions and 0 deletions

View file

@ -271,6 +271,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [JSON with comments](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git) (maintained by @WhyNotHugo)
- [x] [jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) (maintained by @nawordar)
- [x] [julia](https://github.com/tree-sitter/tree-sitter-julia) (maintained by @theHamsta)
- [x] [kconfig](https://github.com/amaanq/tree-sitter-kconfig) (maintained by @amaanq)
- [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (maintained by @amaanq)
- [x] [kotlin](https://github.com/fwcd/tree-sitter-kotlin) (maintained by @SalBakraa)
- [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys)

View file

@ -293,6 +293,9 @@
"julia": {
"revision": "bb7e587837fdeda74dd510256253d60f59a1e2cd"
},
"kconfig": {
"revision": "4242bff4d92964a1cbaa95cb45a87a32b3e1c896"
},
"kdl": {
"revision": "e180e05132c4cb229a8ba679b298790ef1eca77c"
},

View file

@ -899,6 +899,14 @@ list.julia = {
maintainers = { "@theHamsta" },
}
list.kconfig = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-kconfig",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@amaanq" },
}
list.kdl = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-kdl",

View file

@ -0,0 +1,9 @@
[
(config)
(menuconfig)
(choice)
(comment_entry)
(menu)
(if)
(help_text)
] @fold

View file

@ -0,0 +1,81 @@
"source" @include
[
"mainmenu"
"config"
"menuconfig"
"choice"
"endchoice"
"comment"
"menu"
"endmenu"
"prompt"
"default"
"range"
"help"
(optional)
(modules)
] @keyword
[
"if"
"endif"
"depends on"
"select"
"imply"
"visible if"
] @conditional
[
"def_bool"
"def_tristate"
] @keyword.function
[
"||"
"&&"
"="
"!="
"<"
">"
"<="
">="
"!"
] @operator
[
"bool"
"tristate"
"int"
"hex"
"string"
] @type.builtin
[ "(" ")" ] @punctuation.bracket
(macro_variable ["$(" ")"] @punctuation.special)
(symbol) @variable
[
(prompt)
(macro_content)
(text)
] @string
(config name: (symbol) @constant)
(menuconfig name: (symbol) @constant)
(choice name: (symbol) @constant)
((symbol) @constant
(#lua-match? @constant "[A-Z0-9]+"))
(mainmenu name: (prompt) @text.title)
(comment_entry name: (prompt) @text.title)
(menu name: (prompt) @text.title)
(source (prompt) @text.uri @string.special)
(comment) @comment
(ERROR) @error

View file

@ -0,0 +1,11 @@
(help_text (text) @indent.auto)
[
(config)
(menuconfig)
(choice)
(comment_entry)
(menu)
(if)
(help_text)
] @indent.begin

View file

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -0,0 +1,17 @@
[
(symbol)
(prompt)
] @reference
[
(config)
(menuconfig)
(choice)
(comment_entry)
(menu)
(if)
] @scope
(type_definition (prompt) @definition.var)
(type_definition (input_prompt (prompt) @definition.var))
(type_definition_default (expression (prompt) @definition.var))