From 94f02743493d3cb27a233806f10b9633b1cea077 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 21 Nov 2023 06:20:28 +0100 Subject: [PATCH] Added docs --- include/ulas.h | 3 +++ src/ulas.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/ulas.h b/include/ulas.h index 2937c39..ba44fac 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -319,6 +319,9 @@ struct ulas_tok *ulas_symbolresolve(const char *name); 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, diff --git a/src/ulas.c b/src/ulas.c index 1a1ad24..f41bd6e 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -1040,7 +1040,6 @@ void ulas_exprbuffree(struct ulas_exprbuf *eb) { free(eb->buf); } * Assembly step */ - int ulas_istokend(struct ulas_str *tok) { long len = strnlen(tok->buf, tok->maxlen); // skip comments though, they are not trailing tokens! @@ -1359,7 +1358,6 @@ int ulas_intexpr(const char **line, unsigned long n, int *rc) { #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, @@ -1495,7 +1493,7 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) { } // 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); -- 2.30.2