From 70aa166624a5377c8dd60854cea967325af8c21b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 30 May 2025 08:15:29 +0100 Subject: Clean up --- lisp/reader.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lisp/reader.c') 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; } -- cgit v1.2.3-13-gbd6f