News for hackers. Stuff that matters.
Re:Amber: A code search and replace tool by morgante on Friday May 24, 2024 @01:36AM (#40463134)
Yeah it doesn't look like this is AST-aware at all.

If you want to do queries that understand the grammar, https://github.com/getgrit/gritql is closer to what you're looking for. (Disclaimer: I'm the author.)

Ex. here's how you would search for your example of looking for a string unless it's inside a string constant. [0]

grit apply '"this_string" => `new_string` where $match <: not within string()'

[0] https://app.grit.io/studio?key=v8iA8zIbHs2uCykNpSF_G

There are no comments on this comment yet.