From c3738a9eb0e34bd35f0eb84ceb5840af7e384b06 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 27 Mar 2024 13:34:44 -0700 Subject: [PATCH] (uxnasm) Display the correct line number on error --- etc/hello.tal | 1 - src/uxnasm.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/etc/hello.tal b/etc/hello.tal index e504496..0100cef 100644 --- a/etc/hello.tal +++ b/etc/hello.tal @@ -18,7 +18,6 @@ POP2 #010f DEO - @1234 BRK diff --git a/src/uxnasm.c b/src/uxnasm.c index 0b4f82c..c727131 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -105,7 +105,7 @@ walkcomment(FILE *f, int *ln) char c; int depth = 1; while(f && fread(&c, 1, 1, f)) { - if(c == 0xa) *ln++; + if(c == 0xa) *ln += 1; if(c == '(') depth++; if(c == ')' && --depth < 1) return 1; } @@ -132,7 +132,7 @@ walkfile(FILE *f, int *ln) { char c, *cptr = token; while(f && fread(&c, 1, 1, f)) { - if(c == 0xa) *ln++; + if(c == 0xa) *ln += 1; if(c < 0x21) { *cptr++ = 0x00; if(token[0] && !parse(token, f, ln)) @@ -160,9 +160,9 @@ makemacro(char *name, FILE *f, int *ln) m->name = push(name, 0); m->content = dictnext; while(f && fread(&c, 1, 1, f) && c != '{') - if(c == 0xa) *ln++; + if(c == 0xa) *ln += 1; while(f && fread(&c, 1, 1, f) && c != '}') { - if(c == 0xa) *ln++; + if(c == 0xa) *ln += 1; if(c == '%') return 0; if(c == '(') walkcomment(f, ln); *dictnext++ = c;