From a525fadf516bc5aae2c0ec648d3b8c22e9f86293 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 24 Feb 2026 18:53:54 -0500 Subject: Add PIT_DEFAULT_MAIN --- src/parser.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index 9c112c2..b2d0f31 100644 --- a/src/parser.c +++ b/src/parser.c @@ -86,8 +86,18 @@ pit_value pit_parse(pit_runtime *rt, pit_parser *st, bool *eof) { i64 scratch_reset = rt->scratch->next; pit_value ret = PIT_NIL; while (!match(st, PIT_LEX_TOKEN_RPAREN)) { - pit_value *cell = pit_arena_alloc_bulk(rt->scratch, sizeof(pit_value)); - *cell = pit_parse(rt, st, eof); + if (match(st, PIT_LEX_TOKEN_DOT)) { + ret = pit_parse(rt, st, eof); + if (match(st, PIT_LEX_TOKEN_RPAREN)) { + break; + } else { + pit_error(rt, "unterminated dotted list"); + return PIT_NIL; + } + } else { + pit_value *cell = pit_arena_alloc_bulk(rt->scratch, sizeof(pit_value)); + *cell = pit_parse(rt, st, eof); + } if (rt->error != PIT_NIL || (eof != NULL && *eof)) { pit_error(rt, "unterminated list"); return PIT_NIL; /* if we hit an error, stop!*/ -- cgit v1.2.3