Preserve \@ through INCLUDE

Fixes #1112
This commit is contained in:
Rangi
2022-12-11 11:57:45 -05:00
committed by Eldred Habert
parent 69a573923f
commit 01f1703dfb
5 changed files with 61 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
MACRO mac
println "outer mac: \@ (\#)"
INCLUDE "include-unique-id.inc"
ENDM
DEF state = 1
mac hello, world
mac goodbye, world
REPT 2
DEF state = 2
println "outer rept before: \@"
INCLUDE "include-unique-id.inc"
FOR n, 3
DEF state = 3
println "outer for: \@ ({n})"
INCLUDE "include-unique-id.inc"
ENDR
DEF state = 4
println "outer rept after: \@"
INCLUDE "include-unique-id.inc"
ENDR

View File

View File

@@ -0,0 +1,9 @@
IF state == 1
println "inner mac: \@ (\#)"
ELIF state == 2
println "inner rept before: \@"
ELIF state == 3
println "inner for: \@ ({n})"
ELIF state == 4
println "inner rept after: \@"
ENDC

View File

@@ -0,0 +1,24 @@
outer mac: _u1 (hello,world)
inner mac: _u1 (hello,world)
outer mac: _u2 (goodbye,world)
inner mac: _u2 (goodbye,world)
outer rept before: _u3
inner rept before: _u3
outer for: _u4 ($0)
inner for: _u4 ($0)
outer for: _u5 ($1)
inner for: _u5 ($1)
outer for: _u6 ($2)
inner for: _u6 ($2)
outer rept after: _u3
inner rept after: _u3
outer rept before: _u7
inner rept before: _u7
outer for: _u8 ($0)
inner for: _u8 ($0)
outer for: _u9 ($1)
inner for: _u9 ($1)
outer for: _u10 ($2)
inner for: _u10 ($2)
outer rept after: _u7
inner rept after: _u7