# Expand macros

**URL:** <https://forum.crystal-lang.org/t/expand-macros/5943>\
**Category:** Help & Support\
**Created:** [August 16, 2023, 3:32pm UTC](https://forum.crystal-lang.org/t/expand-macros/5943 "2023-08-16T15:32:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![meatball133](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/meatball133/32/1869_2.png) [@meatball133](https://forum.crystal-lang.org/u/meatball133)\
**Post date:** [August 16, 2023, 3:32pm UTC](https://forum.crystal-lang.org/t/expand-macros/5943/1 "2023-08-16T15:32:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Devonte](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/devonte/32/1927_2.png) [@Devonte](https://forum.crystal-lang.org/u/Devonte)\
**Post date:** [August 16, 2023, 3:50pm UTC](https://forum.crystal-lang.org/t/expand-macros/5943/2 "2023-08-16T15:50:57Z")

</div>

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

* * *

1. (sorry, I had to)

---

<div class="post-metadata">

**Author:** ![meatball133](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/meatball133/32/1869_2.png) [@meatball133](https://forum.crystal-lang.org/u/meatball133)\
**Post date:** [August 16, 2023, 3:53pm UTC](https://forum.crystal-lang.org/t/expand-macros/5943/3 "2023-08-16T15:53:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Devonte](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/devonte/32/1927_2.png) [@Devonte](https://forum.crystal-lang.org/u/Devonte)\
**Post date:** [August 16, 2023, 4:56pm UTC](https://forum.crystal-lang.org/t/expand-macros/5943/4 "2023-08-16T16:56:58Z")

</div>

I don’t believe there is a way to normalize macro code within Crystal currently (see [crystal-lang/crystal#3274](https://github.com/crystal-lang/crystal/issues/3274#issuecomment-860092436)) 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.

---

<div class="post-metadata">

**Author:** ![meatball133](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/meatball133/32/1869_2.png) [@meatball133](https://forum.crystal-lang.org/u/meatball133)\
**Post date:** [August 17, 2023, 7:44pm UTC](https://forum.crystal-lang.org/t/expand-macros/5943/5 "2023-08-17T19:44:04Z")

</div>

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