Expand macros

Is there a way to use the expand tool as an api and expand all macros in the source code?

Can you expand[1] on your use case for this?

  1. (sorry, I had to) ↩︎

I want to normalize Crystal code, normal code is fine with using the transformer which uses ASTNodes. But it comes to macros are they very hard to normalize. So I am more or less looking for: A. a way to transform the macro code into normal code or B. being able to transfer the macro into some form of more easily useable ast.

I don’t believe there is a way to normalize macro code within Crystal currently (see crystal-lang/crystal#3274) so option B is your best bet, but the tool wasn’t built for this kind of use-case so extracting the information needed may be a bit of a challenge.

1 Like

Yeah, I figured there wasn’t any way, but thanks for finding me that issue.

1 Like