feat: add fidl parser

This commit is contained in:
巢鹏 2024-02-22 21:57:07 -05:00 committed by GitHub
parent 19bf991be2
commit a8d2b54e28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 84 additions and 0 deletions

View file

@ -164,6 +164,9 @@
"fennel": {
"revision": "9265a7d635d2f82a10738b9ad65ba8dd8bd4a84a"
},
"fidl": {
"revision": "0e1180bb126f280711a62f2a21e3609923fd8b0c"
},
"firrtl": {
"revision": "2b5adae629c8cba528c7b1e4aa67a8ae28934ea5"
},

View file

@ -535,6 +535,15 @@ list.fennel = {
maintainers = { "@alexmozaidze" },
}
list.fidl = {
install_info = {
url = "https://github.com/google/tree-sitter-fidl",
files = { "src/parser.c" },
requires_generate_from_grammar = true,
},
maintainers = { "@chaopeng" },
}
list.firrtl = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-firrtl",

6
queries/fidl/folds.scm Normal file
View file

@ -0,0 +1,6 @@
[
(layout_declaration)
(protocol_declaration)
(resource_declaration)
(service_declaration)
] @fold

View file

@ -0,0 +1,64 @@
[
"ajar"
"alias"
"as"
"bits"
"closed"
"compose"
"const"
"enum"
"error"
"flexible"
"library"
"open"
; "optional" we did not specify a node for optional yet
"overlay"
"protocol"
"reserved"
"resource"
"service"
"strict"
"struct"
"table"
"type"
"union"
"using"
] @keyword
(primitives_type) @type.builtin
(builtin_complex_type) @type.builtin
(const_declaration
(identifier) @constant)
[
"="
"|"
"&"
"->"
] @operator
(attribute
"@" @attribute
(identifier) @attribute)
(string_literal) @string
(numeric_literal) @number
[
(true)
(false)
] @boolean
(comment) @comment
[
"("
")"
"<"
">"
"{"
"}"
] @punctuation.bracket

View file

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