The Crystal Programming Language Forum

Need macro to run after all strings in a program have been defined

In https://github.com/BrucePerens/internationalize/blob/main/src/strings.cr I run a macro to output a list of strings to be translated. The macro sorts them and combines strings that process the same. I currently do this with macro finished in my I18n module, but this runs before all of the strings in the program have been defined.

I need a macro that will run as close to the end of the macro stage of compilation as possible. Is there an internal class that I can run finished on that would work?

If not, I will figure out to hijack the user’s main and emit the strings at run time.

Thanks

Bruce

See also: How to collect all calls of a macro over the entire program?