gbdev / rgbds

Rednex Game Boy Development System - An assembly toolchain for the Nintendo Game Boy and Game Boy Color
https://rgbds.gbdev.io
MIT License
1.33k stars 171 forks source link

More accurate error when redefining the "undefined" `_NARG` and `@` #1500

Closed Rangi42 closed 3 weeks ago

Rangi42 commented 3 weeks ago

Noticed in this comment: DEF(_NARG) is false outside of macros, but you can't define or purge it yourself:

% rgbasm - <<EOF
println DEF(_NARG)
def _NARG equ 0
EOF
$0
error: <stdin>(2):
    '_NARG' already defined at <builtin>
error: Assembly aborted (1 error)!

We could have a more accurate error message for built-ins here. (The same applies to @ outside of sections.)

ISSOtm commented 3 weeks ago

How about “The name '_NARG' is reserved for a builtin symbol”?