The previous logic would have some bugs if you had a tree like this:
key = value
a = ${b} ${key} ${c}
b = ${key}
c = ${key}
This reworks the expand() logic to use a stack which is copied at each
level of recursion. This also fixes bugs when you have more than two
expansions, like this:
The previous logic would have some bugs if you had a tree like this:
This reworks the expand() logic to use a stack which is copied at each level of recursion. This also fixes bugs when you have more than two expansions, like this: