Added docs
authorLukas Krickl <lukas@krickl.dev>
Tue, 21 Nov 2023 05:20:28 +0000 (06:20 +0100)
committerLukas Krickl <lukas@krickl.dev>
Tue, 21 Nov 2023 05:20:28 +0000 (06:20 +0100)
include/ulas.h
src/ulas.c

index 2937c394e890e5b5075b852ea199b6467ac5acdd..ba44fac581a90c773cb12449e601939d87ee482a 100644 (file)
@@ -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,
index 1a1ad2489e3dacfae0d1cef7c49b6756832bf1a4..f41bd6e55b82b9e6328310f17d73e3807b7330c0 100644 (file)
@@ -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);