You don't need a macro, you can just use a template.
template label(name, body) =
{.emit: astToStr(name) & ":".}
body
template goto(name) =
{.emit: "goto " & astToStr(name) & ";".}
proc main =
echo "from here"
goto here
echo "nowhere"
label here:
echo "here we go"
main()
Run
- Performing goto in Nim mardiyah
- Performing goto in Nim Hlaaftana
- Performing goto in Nim sls1005
- Performing goto in Nim Hlaaftana
- Performing goto in Nim sls1005
- Performing goto in Nim xigoi
- Performing goto in Nim Araq
- Performing goto in Nim reneha
- Performing goto in Nim PMunch
- Performing goto in Nim elcritch
- Performing goto in Nim mratsim
- Performing goto in Nim coffeepot
- Performing goto in Nim mratsim
- Performing goto in Nim Araq
