Moved comment check to empty line check
authorLukas Krickl <lukas@krickl.dev>
Mon, 20 Nov 2023 20:41:35 +0000 (21:41 +0100)
committerLukas Krickl <lukas@krickl.dev>
Mon, 20 Nov 2023 20:41:35 +0000 (21:41 +0100)
src/ulas.c

index b57f15da65322349b59c6f14cfafa929fd0efc0b..1a482f05a41f0f69bc18a6c2ac0c8b0ca26a3022 100644 (file)
@@ -1365,10 +1365,6 @@ int ulas_asminstr(char *dst, unsigned long max, const char *line,
     return -1;
   }
 
-  if (ulas_istokend(&ulas.tok)) {
-    return 0;
-  }
-
   if (ulas_tok(&ulas.tok, &line, n) == -1) {
     ULASERR("Expected label or instruction\n");
     return -1;
@@ -1442,8 +1438,8 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) {
   // read the first token and decide
   ulas_tok(&ulas.tok, &line, n);
 
-  // we ignore empty lines
-  if (ulas.tok.buf[0] == '\0') {
+  // we ignore empty lines or all comments lines
+  if (ulas_istokend(&ulas.tok)) {
     ulas_asmlst(start, outbuf, towrite);
     return 0;
   }