I have made this tool for myself:
https://github.com/Otaka/LuaTextProcessor
it is something like C preprocessor, but with macros defined in lua. I am using it for assembler development in assembler that does not support macros. With this tool I can use high level structures