feat: add goctl parser and queries

This commit is contained in:
zhaown 2024-07-07 23:27:21 +08:00 committed by GitHub
parent ad43c7f19e
commit f9aa4f060e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 105 additions and 0 deletions

View file

@ -254,6 +254,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [GN (Generate Ninja)](https://github.com/amaanq/tree-sitter-gn) (maintained by @amaanq)
- [x] [gnuplot](https://github.com/dpezto/tree-sitter-gnuplot) (maintained by @dpezto)
- [x] [go](https://github.com/tree-sitter/tree-sitter-go) (maintained by @theHamsta, @WinWisely268)
- [x] [goctl](https://github.com/chaozwn/tree-sitter-goctl) (maintained by @chaozwn)
- [x] [Godot Resources (gdresource)](https://github.com/PrestonKnopp/tree-sitter-godot-resource) (maintained by @pierpo)
- [x] [gomod](https://github.com/camdencheek/tree-sitter-go-mod) (maintained by @camdencheek)
- [x] [gosum](https://github.com/amaanq/tree-sitter-go-sum) (maintained by @amaanq)

View file

@ -242,6 +242,9 @@
"go": {
"revision": "7ee8d928db5202f6831a78f8112fd693bf69f98b"
},
"goctl": {
"revision": "f107937259c7ec4bb05f7e3d2c24b89ac36d4cc3"
},
"godot_resource": {
"revision": "2ffb90de47417018651fc3b970e5f6b67214dc9d"
},

View file

@ -757,6 +757,14 @@ list.go = {
maintainers = { "@theHamsta", "@WinWisely268" },
}
list.goctl = {
install_info = {
url = "https://github.com/chaozwn/tree-sitter-goctl.git",
files = { "src/parser.c" },
},
maintainers = { "@chaozwn" },
}
list.godot_resource = {
install_info = {
url = "https://github.com/PrestonKnopp/tree-sitter-godot-resource",

11
queries/goctl/folds.scm Normal file
View file

@ -0,0 +1,11 @@
[
(typeGroupSpec)
(typeSingleSpec)
(typeStruct)
(serviceSpec)
(serviceBody)
(importStatement)
(serviceServerSpec)
(infoStatement)
(structType)
] @fold

View file

@ -0,0 +1,79 @@
; Key Symbol
"=" @operator
[
"."
","
":"
";"
] @punctuation.delimiter
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
; Keywords
[
"syntax"
"info"
"service"
] @keyword
"import" @keyword.import
"returns" @keyword.return
[
"type"
"struct"
] @keyword.type
[
"@doc"
"@handler"
"@server"
] @attribute
; Service
(serviceName) @type
; Httpmethod
(HTTPMETHOD) @keyword.operator
; Field
(fieldType) @type.builtin
(fieldName) @variable.member
(anonymousField) @variable.member
; Functions
(handlerValue) @function.method
; Strings
(VALUE) @string
(tag) @string.documentation
(PATH) @string.special.path
; Comments
(comment) @comment @spell
(key) @variable.member
(identValue) @string
(DURATION) @number
(NUMBER) @number
; Struct
(structNameId) @type
(body) @type

View file

@ -0,0 +1,3 @@
; Inject comment language for goctl
((comment) @injection.content
(#set! injection.language "comment"))