feat(sproto): add parser

This commit is contained in:
涵曦 2025-08-11 15:21:23 +08:00 committed by Christian Clason
parent 9866036ec3
commit 13e3ce3bf4
6 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,6 @@
[
(type_definition)
(protocol_definition)
(request_block)
(response_block)
] @fold

View file

@ -0,0 +1,47 @@
(comment) @comment @spell
[
"."
":"
] @punctuation.delimiter
"*" @operator
[
"request"
"response"
] @keyword
(type_definition
name: (identifier) @type)
(nested_type_definition
name: (identifier) @type)
(type_specifier) @type
[
"integer"
"boolean"
"string"
"binary"
"double"
] @type.builtin
(protocol_definition
name: (identifier) @function)
(field_definition
name: (identifier) @property)
(map_specifier
key: (identifier) @property)
(integer) @number
[
"("
")"
"{"
"}"
] @punctuation.bracket

View file

@ -0,0 +1,10 @@
[
(type_definition)
(protocol_definition)
(request_block)
(response_block)
] @indent.begin
"}" @indent.end @indent.branch
(comment) @indent.auto

View file

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