int ulas_tok(struct ulas_str *dst, const char **out_line, unsigned long n);
// converts a token string to a token struct
+// this is only useful if we do not require the token literal
+// but rather can be used to store a slimmer list of token types
+// and literal values
struct ulas_tok ulas_totok(char *buf, unsigned long n, int *rc);
int ulas_tokuntil(struct ulas_str *dst, char c, const char **out_line,
* Assembly step
*/
-
int ulas_istokend(struct ulas_str *tok) {
long len = strnlen(tok->buf, tok->maxlen);
// skip comments though, they are not trailing tokens!
#define ULAS_ISINSTR(tok, name, n) (strncmp(tok, name, n) == 0)
-
// assembles an instruction, writes bytes into dst
// returns bytes written or -1 on error
int ulas_asminstr(char *dst, unsigned long max, const char *line,
}
// check for trailing
- // but only if its not a comment
+ // 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);