| 1 |
((comment) @injection.content |
| 2 |
(#set! injection.language "comment")) |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
(source_file |
| 13 |
(comment) @injection.content . (comment)* . [ |
| 14 |
(package_clause) |
| 15 |
(type_declaration) |
| 16 |
(function_declaration) |
| 17 |
(method_declaration) |
| 18 |
(var_declaration) |
| 19 |
(const_declaration) |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
(var_spec) |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
(const_spec) |
| 30 |
] |
| 31 |
(#set! injection.language "markdown")) |
| 32 |
|
| 33 |
((comment) @injection.content |
| 34 |
(#match? @injection.content "^//go:generate") |
| 35 |
(#set! injection.language "bash")) |
| 36 |
|
| 37 |
(call_expression |
| 38 |
(selector_expression) @_function |
| 39 |
(#any-of? @_function "regexp.Match" "regexp.MatchReader" "regexp.MatchString" "regexp.Compile" "regexp.CompilePOSIX" "regexp.MustCompile" "regexp.MustCompilePOSIX") |
| 40 |
(argument_list |
| 41 |
. |
| 42 |
[ |
| 43 |
(raw_string_literal (raw_string_literal_content) @injection.content) |
| 44 |
(interpreted_string_literal (interpreted_string_literal_content) @injection.content) |
| 45 |
] |
| 46 |
(#set! injection.language "regex"))) |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
((call_expression |
| 53 |
function: (selector_expression |
| 54 |
operand: (identifier) @_module |
| 55 |
field: (field_identifier) @_func) |
| 56 |
arguments: (argument_list |
| 57 |
. (interpreted_string_literal) @injection.content)) |
| 58 |
(#eq? @_module "fmt") |
| 59 |
(#any-of? @_func "Printf" "Sprintf" "Scanf" "Errorf") |
| 60 |
(#set! injection.language "go-format-string")) |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
((call_expression |
| 66 |
function: (selector_expression |
| 67 |
operand: (identifier) @_module |
| 68 |
field: (field_identifier) @_func) |
| 69 |
arguments: (argument_list |
| 70 |
|
| 71 |
(_) |
| 72 |
|
| 73 |
. |
| 74 |
(interpreted_string_literal) @injection.content)) |
| 75 |
(#eq? @_module "fmt") |
| 76 |
(#any-of? @_func "Fprintf" "Fscanf" "Sscanf") |
| 77 |
(#set! injection.language "go-format-string")) |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
((call_expression |
| 86 |
function: (selector_expression |
| 87 |
operand: (identifier) |
| 88 |
field: (field_identifier) @_func) |
| 89 |
arguments: (argument_list |
| 90 |
. (interpreted_string_literal) @injection.content)) |
| 91 |
(#any-of? @_func "Printf" "Fatalf" "Panicf") |
| 92 |
(#set! injection.language "go-format-string")) |