// check for any expression terminators here
if (tok.type == term || tok.type == ULAS_TOK_COMMENT) {
+ // on terminator we roll back line so that the terminator token
+ // is not consumed now
+ *line -= tokrc;
goto end;
}
int ulas_asminstr(char *dst, unsigned long max, const char *line,
unsigned long n) {
- if (max < 3) {
+ if (max < 4) {
ULASPANIC("Instruction buffer is too small!");
return -1;
}
return -1;
}
- // check for trailing
- if (ulas_tok(&ulas.tok, &line, n) > 0) {
- if (!ulas_istokend(&ulas.tok)) {
- ULASERR("Trailing token '%s'\n", ulas.tok.buf);
- return -1;
- }
- }
-
return rc;
}
// only node in an expression!
}
+ // check for trailing
+ // but only if its not a comment
+ if (ulas_tok(&ulas.tok, &line, n) > 0) {
+ if (!ulas_istokend(&ulas.tok)) {
+ ULASERR("Trailing token '%s'\n", ulas.tok.buf);
+ return -1;
+ }
+ }
+
ulas_asmout(dst, outbuf, towrite);
ulas_asmlst(start, outbuf, towrite);
ulas.address += towrite;