2023-05-03 19:07:59 +09:00
|
|
|
([
|
2023-03-26 14:45:50 -04:00
|
|
|
(line_comment)
|
|
|
|
|
(multiline_comment)
|
2024-01-06 15:05:50 +09:00
|
|
|
] @injection.content
|
|
|
|
|
(#set! injection.language "comment"))
|
2024-01-20 18:47:56 +09:00
|
|
|
|
2022-01-06 02:19:44 +03:00
|
|
|
; There are 3 ways to define a regex
|
|
|
|
|
; - "[abc]?".toRegex()
|
|
|
|
|
(call_expression
|
2023-05-03 19:07:59 +09:00
|
|
|
(navigation_expression
|
2026-03-27 15:22:25 -07:00
|
|
|
((string_literal
|
|
|
|
|
(string_content) @injection.content)
|
2024-01-06 15:05:50 +09:00
|
|
|
(#set! injection.language "regex"))
|
|
|
|
|
(navigation_suffix
|
|
|
|
|
((simple_identifier) @_function
|
|
|
|
|
(#eq? @_function "toRegex")))))
|
2022-01-06 02:19:44 +03:00
|
|
|
|
|
|
|
|
; - Regex("[abc]?")
|
|
|
|
|
(call_expression
|
2023-05-03 19:07:59 +09:00
|
|
|
((simple_identifier) @_function
|
|
|
|
|
(#eq? @_function "Regex"))
|
|
|
|
|
(call_suffix
|
|
|
|
|
(value_arguments
|
|
|
|
|
(value_argument
|
2026-03-27 15:22:25 -07:00
|
|
|
(string_literal
|
|
|
|
|
(string_content) @injection.content)
|
2024-01-06 15:05:50 +09:00
|
|
|
(#set! injection.language "regex")))))
|
2022-01-06 02:19:44 +03:00
|
|
|
|
|
|
|
|
; - Regex.fromLiteral("[abc]?")
|
|
|
|
|
(call_expression
|
2023-05-03 19:07:59 +09:00
|
|
|
(navigation_expression
|
|
|
|
|
((simple_identifier) @_class
|
2024-01-06 15:05:50 +09:00
|
|
|
(#eq? @_class "Regex"))
|
2023-05-03 19:07:59 +09:00
|
|
|
(navigation_suffix
|
|
|
|
|
((simple_identifier) @_function
|
2024-01-06 15:05:50 +09:00
|
|
|
(#eq? @_function "fromLiteral"))))
|
2023-05-03 19:07:59 +09:00
|
|
|
(call_suffix
|
|
|
|
|
(value_arguments
|
|
|
|
|
(value_argument
|
2026-03-27 15:22:25 -07:00
|
|
|
(string_literal
|
|
|
|
|
(string_content) @injection.content)
|
2024-01-06 15:05:50 +09:00
|
|
|
(#set! injection.language "regex")))))
|
2023-08-19 19:28:45 +03:00
|
|
|
|
|
|
|
|
; "pi = %.2f".format(3.14159)
|
|
|
|
|
((call_expression
|
|
|
|
|
(navigation_expression
|
2026-03-27 15:22:25 -07:00
|
|
|
(string_literal
|
|
|
|
|
(string_content) @injection.content)
|
2024-01-06 15:05:50 +09:00
|
|
|
(navigation_suffix
|
|
|
|
|
(simple_identifier) @_method)))
|
|
|
|
|
(#eq? @_method "format")
|
|
|
|
|
(#set! injection.language "printf"))
|