gbdev/rgbds

[Feature request] Allow multiple labels per line

Closed this issue · 2 comments

Based on leaderjord's question on Discord.

Now that Global: and .local labels are both column-independent, it should be possible to unambiguously lex and parse multiple labels per line. This would avoid surprise based on an implementation detail of the parser rules, and would allow use cases like these:

MyColor: MyColour: dw $7fff
ZeroFill:
    xor a
Fill: .loop
    ld [hli], a
    dec c
    jr nz, .loop
    ret
MyData: MyDataRow: my_data_macro "-"
    MyDataRowEnd:
    my_data_macro "A"
    my_data_macro "B"
    my_data_macro "C"
; data size is MyDataRowEnd - MyDataRow

Or even:

Fill: .loop: ld [hli], a :: dec c :: jr nz, .loop :: ret

:3

ISSOtm commented

This breaks more of third-party tools' assumptions than it brings benefits, IMO. I'd rather reject this unless a compelling argument is made for it.

Current workaround, if you really value your vertical space:

def NL equs "\n" ; NewLine
Fill: NL .loop: ld [hli], a :: dec c :: jr nz, .loop :: ret