macro expansion: Fixed bug that prevented nested macros from expanding master origin/HEAD origin/master
authorLukas Krickl <lukas@krickl.dev>
Sun, 26 Apr 2026 13:43:20 +0000 (15:43 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 26 Apr 2026 13:43:20 +0000 (15:43 +0200)
commita750c69e0583ca0b74d1b3a77607331ccc07c1c6
treeeb5679161343fb01e8e6d44df07d303014f883a6
parent8c53f41078ac866e05479cb472dce82007221484
macro expansion: Fixed bug that prevented nested macros from expanding
correctly.

The way nested macros were handeled previously was broken in many ways.
Now we tokenize the first expansion's lines and expand them
individually.
This fixed nested macros.
Previosuly it was also possible to get stuck in an infinite loop.

The current implementation uses a lot of ulas_str and malloc/free which
is not great, but in the end it should be ok.
makefile
src/test.c
src/ulas.c
src/ulas.h
tests/macroexpandnested.bin [new file with mode: 0644]
tests/macroexpandnested.s [new file with mode: 0644]