feat(streamdevice_proto): add parser and queries

This commit is contained in:
Minijackson 2025-09-30 10:38:32 +02:00
parent 6e42d823ce
commit 5d9526e9b0
No known key found for this signature in database
GPG key ID: FEA888C9F5D64F62
6 changed files with 149 additions and 0 deletions

View file

@ -0,0 +1,90 @@
(comment) @comment @spell
(variable_name) @constant
(enum_constant) @constant
(ascii_name) @constant.builtin
"=" @operator
[
(function_name)
(command_name)
(handler_name)
] @function
((command_name) @function.builtin
(#any-of? @function.builtin "out" "in" "wait" "event" "exec" "disconnect" "connect"))
((handler_name) @function.builtin
(#any-of? @function.builtin "mismatch" "writetimeout" "replytimeout" "readtimeout" "init"))
[
"{"
"}"
"["
"]"
"("
")"
"<"
">"
] @punctuation.bracket
[
"$"
"\\$"
"@"
"/"
"#/"
] @punctuation.special
(variable_expansion
[
"\\${"
"}"
] @punctuation.special)
(format_converter
[
"%"
"{"
"}"
"["
"]"
"("
")"
"<"
">"
"#/"
"/"
] @punctuation.special)
[
"|"
";"
","
"."
] @punctuation.delimiter
(quoted_literal) @string
(escape_sequence) @string.escape
(format_converter) @function.builtin
(checksum_flag) @operator
(checksum) @function
(regex_pattern) @string.regexp
(time_conversion_spec) @constant.builtin
(keyword) @keyword
(record_name) @constant
(field_name) @variable.member
(number) @number

View file

@ -0,0 +1,21 @@
[
(function)
(handler)
] @indent.begin
[
"{"
"}"
"("
")"
] @indent.branch
[
"}"
")"
] @indent.end
[
(comment)
(string)
] @indent.auto

View file

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

View file

@ -0,0 +1,22 @@
(source_file) @local.scope
; The content of a function is a scope, not the whole function block.
; Else, the function is defined inside itself
(function
.
(function_name)
.
(_) @local.scope)
(function
.
(function_name) @local.definition.function)
(assignment
(variable_name) @local.definition.var)
(variable_name) @local.reference
((handler
(function_name) @local.reference)
(#set! reference.kind "call"))