I've done exactly what you're talking about using tree-sitter (via the tarborist VS Code extension), specific to targets pipelines:
https://bsky.app/profile/tylermw.com/post/3mjmcykuows2d
So yes, it is possible and quite useful!
https://bsky.app/profile/tylermw.com/post/3mjmcykuows2d
So yes, it is possible and quite useful!