commit 04740ac

Devine Lu Linvega  ·  2024-04-04 03:34:58 +0000 UTC
parent 1e66542
(uxnasm) Report the correct line number in references
1 files changed,  +5, -6
+5, -6
 1@@ -112,7 +112,7 @@ walkcomment(FILE *f, Context *ctx)
 2 	char c;
 3 	int depth = 1;
 4 	while(f && fread(&c, 1, 1, f)) {
 5-		if(c == 0xa) ctx->line += 1;
 6+		if(c == 0xa) ctx->line++;
 7 		if(c == '(') depth++;
 8 		if(c == ')' && --depth < 1) return 1;
 9 	}
10@@ -139,11 +139,10 @@ walkfile(FILE *f, Context *ctx)
11 {
12 	char c, *cptr = token;
13 	while(f && fread(&c, 1, 1, f)) {
14-		if(c == 0xa) ctx->line += 1;
15 		if(c < 0x21) {
16 			*cptr++ = 0x00;
17-			if(token[0] && !parse(token, f, ctx))
18-				return 0;
19+			if(token[0] && !parse(token, f, ctx)) return 0;
20+			if(c == 0xa) ctx->line++;
21 			cptr = token;
22 		} else if(cptr - token < 0x3f)
23 			*cptr++ = c;
24@@ -177,9 +176,9 @@ makemacro(char *name, FILE *f, Context *ctx)
25 	m->name = push(name, 0);
26 	m->data = dictnext;
27 	while(f && fread(&c, 1, 1, f) && c != '{')
28-		if(c == 0xa) ctx->line += 1;
29+		if(c == 0xa) ctx->line++;
30 	while(f && fread(&c, 1, 1, f)) {
31-		if(c == 0xa) ctx->line += 1;
32+		if(c == 0xa) ctx->line++;
33 		if(c == '%') return error_top("Macro nested", name);
34 		if(c == '{') depth++;
35 		if(c == '}' && --depth) break;