Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels can be defined with colons in their name #362

Closed
ISSOtm opened this issue Jun 25, 2019 · 1 comment · Fixed by #364
Closed

Labels can be defined with colons in their name #362

ISSOtm opened this issue Jun 25, 2019 · 1 comment · Fixed by #364

Comments

@ISSOtm
Copy link
Member

ISSOtm commented Jun 25, 2019

issotm@link-panda tmp.rLFWz9K2Ej% cat label.asm
labels: macro
\1
End\1
endm

SECTION "Test", ROM0
 labels Test:
issotm@link-panda tmp.rLFWz9K2Ej% rgbasm -E -o label.o label.asm          
issotm@link-panda tmp.rLFWz9K2Ej% rgblink -n label.sym -o label.gb label.o
issotm@link-panda tmp.rLFWz9K2Ej% cat label.sym
; File generated by rgblink

00:0000 Test
00:0000 EndTest:
issotm@link-panda tmp.rLFWz9K2Ej% 

I expected the second label to be defined like the first, without the colon.

@dbrotz
Copy link
Contributor

dbrotz commented Jun 26, 2019

It's worse than that. Any character that can be used in a macro arg can be used in a symbol name using this trick. For example, you can even put spaces in a symbol name. The following code produces a label with the name "xa b".

SECTION "sec", ROM0

m: MACRO
x\1
	global x\1
ENDM

	m a b

To fix this, we probably want to end the symbol token early and process the rest of the macro arg as separate tokens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants