3 ms·
Looks like the project is only about 12 months old, so if you last checked it out 6 months ago it's worth taking another look. Was it possible to use it entire
by simonw 3y ago
Looks like the project is only about 12 months old, so if you last checked it out 6 months ago it's worth taking another look.
Was it possible to use it entirely as a CLI tool without any YAML 6 months ago?
- Conscat 3y agoUnless the search/replace is super simple, you need the YAML as far as I can tell. The refactor I gave up on automating had to do with changing variadic C++ macros into arithmetic expressions, which wasn't conceptually very complicated, but felt almost impossible while constantly tripping over YAML syntax errors.
- simonw 3y agoThe YAML syntax I find most useful for this kind of thing is this: something: subkey: | I can put any characters I like in here And they "won't be messed up" by anything Because they are part of a multi-line string
- herrington_d 3y ago> changing variadic C++ macros into arithmetic expressions I don't know your exact use case but it sounds a little bit hard to me. I guess you want to change things like this. ```cpp add_macro(a, b, c, d); // before a + b + c + d; // after ``` It isn't that easy to do in pattern syntax. The pattern/replacement must support repetition and it isn't straightforward as far as I can tell from Rust's macro[0]. That said, if you need to support use cases like this, ast-grep has Python API to support programmatic usage[1]. [0] https://veykril.github.io/tlborm/decl-macros/macros-methodical.html#repetitions https://veykril.github.io/tlborm/decl-macros/macros-methodic... [1] https://ast-grep.github.io/guide/api-usage/py-api.html https://ast-grep.github.io/guide/api-usage/py-api.html