tree-sitter-grammars / tree-sitter-bitbake

BitBake grammar for tree-sitter
MIT License
15 stars 6 forks source link

inline_python is not found when insideo shell function #10

Closed idillon-sfl closed 1 year ago

idillon-sfl commented 1 year ago

Hello!

I noticed inline_python won't be detected when inside a shell function

Here's a somewhat minimal example:

foo() {
  echo ${@"bar"}
}

Here a real-life example from poky: https://git.yoctoproject.org/poky/tree/meta/recipes-support/icu/icu_73-2.bb#n126

Thank you, we love this library

amaanq commented 1 year ago

It's not possible because you're trying to inject a language within a language - you may consider looking for bash regions that have a shell expansion starting with an @, then reparse that range as bitbake, but that also won't work as that alone wouldn't be valid bitbake syntax

idillon-sfl commented 1 year ago

Do you mean it would not be feasible with tree-sitter?

Otherwise, I am quite sure this is valid BitBake syntax. It can be found all over poky's source code. Here more examples: https://git.yoctoproject.org/poky/tree/meta/recipes-bsp/alsa-state/alsa-state.bb#n40 https://git.yoctoproject.org/poky/tree/meta/recipes-kernel/kexec/kexec-tools_2.0.27.bb#n47

We might investigate the issue further in 2024 and send a PR

amaanq commented 1 year ago

Nvm, I was thinking from an injection POV, it's fine just for parsing and I've fixed it accordingly using the scanner