feat: add koto

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
This commit is contained in:
Ian Hobson 2024-04-25 15:43:41 +02:00 committed by GitHub
parent df111f886c
commit 19c6b0c4c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 182 additions and 0 deletions

View file

@ -294,6 +294,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [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] [koto](https://github.com/koto-lang/tree-sitter-koto) (maintained by @irh)
- [x] [kusto](https://github.com/Willem-J-an/tree-sitter-kusto) (maintained by @Willem-J-an)
- [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys)
- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason)

View file

@ -362,6 +362,9 @@
"kotlin": {
"revision": "260afd9a92bac51b3a4546303103c3d40a430639"
},
"koto": {
"revision": "85e689c17abab691e033080da726a792b3711df0"
},
"kusto": {
"revision": "8353a1296607d6ba33db7c7e312226e5fc83e8ce"
},

View file

@ -1082,6 +1082,14 @@ list.kotlin = {
maintainers = { "@SalBakraa" },
}
list.koto = {
install_info = {
url = "https://github.com/koto-lang/tree-sitter-koto",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@irh" },
}
list.kusto = {
install_info = {
url = "https://github.com/Willem-J-an/tree-sitter-kusto",

9
queries/koto/folds.scm Normal file
View file

@ -0,0 +1,9 @@
[
(assign)
(comment)
(function)
(list)
(map)
(tuple)
(string)
] @fold

131
queries/koto/highlights.scm Normal file
View file

@ -0,0 +1,131 @@
[
"="
"+"
"-"
"*"
"/"
"%"
"+="
"-="
"*="
"/="
"%="
"=="
"!="
"<"
">"
"<="
">="
".."
"..="
] @operator
[
"and"
"not"
"or"
] @keyword.operator
[
"return"
"yield"
] @keyword.return
[
"if"
"then"
"else"
"else if"
"match"
"switch"
] @keyword.conditional
[
(break)
(continue)
"for"
"in"
"loop"
"until"
"while"
] @keyword.repeat
[
"throw"
"try"
"catch"
"finally"
] @keyword.exception
[
"export"
"from"
"import"
"as"
] @keyword.import
[
"("
")"
"["
"]"
"{"
"}"
"|"
] @punctuation.bracket
(identifier) @variable
(import_module
(identifier) @module)
(import_item
(identifier) @module)
(export
(identifier) @module)
(chain
lookup: (identifier) @variable.member)
(chain
start: (identifier) @function.call)
[
(true)
(false)
] @boolean
(comment) @comment @spell
(debug) @keyword.debug
(string) @string
(fill_char) @punctuation.delimiter
(alignment) @operator
(escape) @string.escape
(null) @constant.builtin
(number) @number
(meta) @keyword.directive
(meta
name: (identifier) @variable.member)
(entry_inline
key: (identifier) @variable.member)
(entry_block
key: (identifier) @variable.member)
(self) @variable.builtin
(arg
(identifier) @variable.parameter)
(ellipsis) @variable.parameter

View file

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

28
queries/koto/locals.scm Normal file
View file

@ -0,0 +1,28 @@
; Scopes
(function
body: (_) @local.scope)
; Definitions
(arg
(identifier) @local.definition.parameter)
(assign
(identifier) @local.definition.var)
(for_args
(identifier) @local.definition.var)
(match_patterns
(identifier) @local.definition.var)
(import_item
(identifier) @local.definition.import)
(entry_block
(identifier) @local.definition.field)
(entry_inline
(identifier) @local.definition.field)
; References
(identifier) @local.reference