nvim-treesitter/queries/rust/injections.scm
Tobias Hunger 0f3183dda8
feat(slint)!: change to the official parser (#6027)
This change replaces the slint parser written and maintained by @jrmoulton
with the official one hosted in the slint-ui organization on github.

A huge thank you to @jrmoulton for all his work on the tree-sitter
parser!

---------

Co-authored-by: jrmoulton <jaredmoulton3@gmail.com>
2024-02-09 13:46:57 +00:00

75 lines
1.8 KiB
Scheme

(macro_invocation
macro:
[
(scoped_identifier
name: (_) @_macro_name)
(identifier) @_macro_name
]
(token_tree) @injection.content
(#not-eq? @_macro_name "slint")
(#set! injection.language "rust")
(#set! injection.include-children))
(macro_invocation
macro:
[
(scoped_identifier
name: (_) @_macro_name)
(identifier) @_macro_name
]
(token_tree) @injection.content
(#eq? @_macro_name "slint")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "slint")
(#set! injection.include-children))
(macro_definition
(macro_rule
left: (token_tree_pattern) @injection.content
(#set! injection.language "rust")))
(macro_definition
(macro_rule
right: (token_tree) @injection.content
(#set! injection.language "rust")))
([
(line_comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))
((macro_invocation
macro: (identifier) @injection.language
(token_tree) @injection.content)
(#any-of? @injection.language "html" "json"))
(call_expression
function:
(scoped_identifier
path: (identifier) @_regex
(#eq? @_regex "Regex")
name: (identifier) @_new
(#eq? @_new "new"))
arguments:
(arguments
(raw_string_literal) @injection.content)
(#set! injection.language "regex"))
(call_expression
function:
(scoped_identifier
path:
(scoped_identifier
(identifier) @_regex
(#eq? @_regex "Regex") .)
name: (identifier) @_new
(#eq? @_new "new"))
arguments:
(arguments
(raw_string_literal) @injection.content)
(#set! injection.language "regex"))
((block_comment) @injection.content
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
(#set! injection.language "re2c"))