aboutsummaryrefslogtreecommitdiff
path: root/lisp/reader.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-05-30 08:15:29 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-05-30 08:15:29 +0100
commit70aa166624a5377c8dd60854cea967325af8c21b (patch)
tree4ec6497fc5c557cb4266f23627c92a1fb069f613 /lisp/reader.c
parent4dc3d8f8325994d737f1959c1554480f4ccbc60f (diff)
downloadoats-70aa166624a5377c8dd60854cea967325af8c21b.tar.gz
oats-70aa166624a5377c8dd60854cea967325af8c21b.tar.bz2
oats-70aa166624a5377c8dd60854cea967325af8c21b.zip
Clean up
Diffstat (limited to 'lisp/reader.c')
-rw-r--r--lisp/reader.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/reader.c b/lisp/reader.c
index 0c8a914..b8e79db 100644
--- a/lisp/reader.c
+++ b/lisp/reader.c
@@ -159,7 +159,7 @@ perr_t parse_sym(context_t *ctx, input_t *inp, lisp_t **ret)
sv_t current = sv_cut(inp->str, inp->offset);
sv_t sym = sv_chop(current, sv_while(current, is_sym));
- debug("`" PR_SV "`\n", SV_FMT(sym));
+ debug("`" PR_SV "` => ", SV_FMT(sym));
if (sym.size == 3)
{
@@ -174,13 +174,14 @@ perr_t parse_sym(context_t *ctx, input_t *inp, lisp_t **ret)
if (strncmp(buf, "NIL", 3) == 0)
{
input_next(inp, 3);
- return NIL;
+ *ret = NIL;
+ return PERR_OK;
}
}
- lisp_t *lsym = make_sym(ctx, sym.data, sym.size);
+ *ret = make_sym(ctx, sym.data, sym.size);
+ debug("%#16lx\n", *ret);
input_next(inp, sym.size);
- *ret = lsym;
return PERR_OK;
}
@@ -293,8 +294,9 @@ perr_t parse_str(context_t *ctx, input_t *inp, lisp_t **ret)
input_next(inp, size + 1); // 1 for that last speechmark
sv_t str_content = sv_chop(sv, size);
- debug("\"" PR_SV "\"\n", SV_FMT(str_content));
+ debug("\"" PR_SV "\" => ", SV_FMT(str_content));
*ret = make_str(ctx, str_content.data, str_content.size);
+ debug("%#16lx\n", *ret);
return PERR_OK;
}