uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 9f7391395f2666436c8f2bcec09545e2345c6226
parent 683eb6b8590baa19a78c93fdc8f8cf1fced8e2f6
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Tue, 26 Mar 2024 11:10:08 -0700

makelabel detects sublabels

Diffstat:
Msrc/uxnasm.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -179,6 +179,8 @@ static int makelabel(char *name) { Label *l; + if(name[0] == '&') + name = makesublabel(sublabel, p.scope, name + 1); if(!slen(name)) return error_asm("Label is empty"); if(findlabel(name)) return error_asm("Label is duplicate"); if(sihx(name)) return error_asm("Label is hex number"); @@ -313,7 +315,7 @@ static int parse(char *w, FILE *f) { int i; - char word[0x40], subw[0x40], c; + char word[0x40], c; Macro *m; switch(w[0]) { case '(': /* comment */ @@ -350,7 +352,7 @@ parse(char *w, FILE *f) p.scope[i] = '\0'; break; case '&': /* sublabel */ - if(!makesublabel(subw, p.scope, w + 1) || !makelabel(subw)) + if(!makelabel(w)) return error_asm("Invalid sublabel"); break; case '#': /* literals hex */