digitalmars.D.learn - How do I use libdparser, or any library for editing D code?
- Liam McGillivray (20/20) Mar 25 I want to do some automated mass-editing of some source code in
- Liam McGillivray (2/2) Mar 25 Unfortunately there's no "edit" option here, but the library I
I want to do some automated mass-editing of some source code in D. If there is such a library available that knows how to process D code, similar to `std.json` but for D, then I would like to use it. I looked at libdparser, but the documentation makes it look like a nightmare. Only one example is provided, and it's rather complicated despite seemingly doing very little. https://github.com/dlang-community/libdparse/#Example Are you kidding me? Anyway, is there any library that can process a D source file and split it into pieces, similarly to `std.json`, but in a way that makes it easy to use for editing? I would want it to know to recognize things like the scope in which a symbol is declared (the function, class, enum, struct, etc). Here are some things I would like to automate: - Mass-editing an enum to give each member an alternative identifier. - Looking for functions, and adding an overloaded version for each function declared with a certain argument type. I would make the format for how the overloaded definition will look.
Mar 25
Unfortunately there's no "edit" option here, but the library I was referring to is actually "libdparse".
Mar 25