For example, let us take this code:
Method m()
{
$$$someMacro
}
Or:
Method m(foo as whatever)
{
$$$otherMacro(foo)
}
Provided that I can extract someMacro
and otherMacro
from the code samples above, is there a way to programmatically expand them?
No. Macro can only be resolved at compile time. Since what macro expands into may depend on where in code macro is placed you can't expand one macro without context.