diff options
Diffstat (limited to 'runtime/queries/bash/injections.scm')
| -rw-r--r-- | runtime/queries/bash/injections.scm | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm new file mode 100644 index 000000000..9b86e351a --- /dev/null +++ b/runtime/queries/bash/injections.scm @@ -0,0 +1,79 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((regex) @injection.content + (#set! injection.language "regex")) + +((heredoc_redirect + (heredoc_body) @injection.content + (heredoc_end) @injection.language) + (#downcase! @injection.language)) + +; printf 'format' +((command + name: (command_name) @_command + . + argument: [ + (string) @injection.content + (concatenation + (string) @injection.content) + (raw_string) @injection.content + (concatenation + (raw_string) @injection.content) + ]) + (#eq? @_command "printf") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "printf")) + +; printf -v var 'format' +((command + name: (command_name) @_command + argument: (word) @_arg + . + (_) + . + argument: [ + (string) @injection.content + (concatenation + (string) @injection.content) + (raw_string) @injection.content + (concatenation + (raw_string) @injection.content) + ]) + (#eq? @_command "printf") + (#eq? @_arg "-v") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "printf")) + +; printf -- 'format' +((command + name: (command_name) @_command + argument: (word) @_arg + . + argument: [ + (string) @injection.content + (concatenation + (string) @injection.content) + (raw_string) @injection.content + (concatenation + (raw_string) @injection.content) + ]) + (#eq? @_command "printf") + (#eq? @_arg "--") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "printf")) + +((command + name: (command_name) @_command + . + argument: [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "bind") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "readline")) |
