mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-22 03:02:06 +00:00
Prohibit nested macros
After discussion (starting there: https://github.com/gbdev/rgbds/pull/594#issuecomment-706437458 ), it was decided that plain nested macros should not be allowed. Since #590 is fixed, EQUS can be used as a workaround; multiline strings (#589) will make that easier on the user when implemented. Fixes #588, supersedes and closes #594. Additionally, closes #388.
This commit is contained in:
@@ -923,6 +923,26 @@ Note that a single colon
|
||||
.Ql \&:
|
||||
following the macro's name is required.
|
||||
Macros can't be exported or imported.
|
||||
.Pp
|
||||
Plainly nesting macro definitions is not allowed, but this can be worked around using
|
||||
.Ic EQUS .
|
||||
This won't work:
|
||||
.Bd -literal -offset indent
|
||||
outer: MACRO
|
||||
inner: MACRO
|
||||
PRINTT "Hello!\[rs]n"
|
||||
ENDM
|
||||
ENDM
|
||||
.Ed
|
||||
.Pp
|
||||
But this will:
|
||||
.Bd -literal -offset indent
|
||||
outer: MACRO
|
||||
definition equs "inner: MACRO\[rs]nPRINTT \[rs]"Hello!\[rs]\[rs]n\[rs]"\[rs]nENDM"
|
||||
definition
|
||||
PURGE definition
|
||||
ENDM
|
||||
.Ed
|
||||
.El
|
||||
.Ss Exporting and importing symbols
|
||||
Importing and exporting of symbols is a feature that is very useful when your project spans many source files and, for example, you need to jump to a routine defined in another file.
|
||||
|
||||
Reference in New Issue
Block a user