nvim-treesitter/queries/teal/injections.scm

44 lines
1 KiB
Scheme
Raw Normal View History

2024-01-06 15:05:50 +09:00
((function_call
(index
(identifier) @_cdef_identifier)
(arguments
(string) @injection.content))
2021-03-08 22:35:21 +00:00
(#eq? @_cdef_identifier "cdef")
(#lua-match? @injection.content "^[\"']")
(#offset! @injection.content 0 1 0 -1)
2024-01-06 15:05:50 +09:00
(#set! injection.language "c"))
2021-09-21 20:41:17 +02:00
2024-01-06 15:05:50 +09:00
((function_call
(index
(identifier) @_cdef_identifier)
(arguments
(string) @injection.content))
2021-09-21 20:41:17 +02:00
(#eq? @_cdef_identifier "cdef")
(#lua-match? @injection.content "^%[%[")
(#offset! @injection.content 0 2 0 -2)
2024-01-06 15:05:50 +09:00
(#set! injection.language "c"))
; string.format('...')
((function_call
(index
(identifier) @_base
key: (identifier) @_entry)
2024-01-06 15:05:50 +09:00
(arguments
.
(string) @injection.content))
(#eq? @_base "string")
(#eq? @_entry "format")
(#set! injection.language "printf"))
; ('...'):format()
((function_call
2024-01-06 15:05:50 +09:00
(method_index
(parenthesized_expression
(string) @printf)
key: (identifier) @_func))
2024-01-06 15:05:50 +09:00
(#eq? @_func "format")
(#set! injection.language "printf"))
((comment) @injection.content
2024-01-06 15:05:50 +09:00
(#set! injection.language "comment"))