commit 2cb393b
Devine Lu Linvega
·
2024-12-31 23:15:49 +0000 UTC
parent 8ac7568
(uxnasm) Only count comments on token
1 files changed,
+7,
-4
+7,
-4
1@@ -158,12 +158,15 @@ findopcode(char *s)
2 static int
3 walkcomment(FILE *f, Context *ctx)
4 {
5- char c;
6+ char c, last = 0;
7 int depth = 1;
8 while(f && fread(&c, 1, 1, f)) {
9 if(c == 0xa) ctx->line++;
10- if(c == '(') depth++;
11- if(c == ')' && --depth < 1) return 1;
12+ if(last <= 0x20){
13+ if(c == '(') depth++;
14+ if(c == ')' && --depth < 1) return 1;
15+ }
16+ last = c;
17 }
18 return error_asm("Comment incomplete");
19 }
20@@ -466,7 +469,7 @@ main(int argc, char *argv[])
21 {
22 ptr = PAGE;
23 copy("on-reset", scope, 0);
24- if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 14 Nov 2024.\n");
25+ if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 31 Dec 2024.\n");
26 if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom");
27 return !assemble(argv[1]) || !resolve(argv[2]) || !build(argv[2]);
28 }