From 5cf9c90f53b79ed147eb28377a5a94e2abdc5df8 Mon Sep 17 00:00:00 2001 From: Sudipto Mallick Date: Sat, 13 Mar 2021 14:06:10 +0000 Subject: add error for unclosed lists --- lith.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lith.c') diff --git a/lith.c b/lith.c index 400149c..8d2947c 100644 --- a/lith.c +++ b/lith.c @@ -190,7 +190,12 @@ static lith_value *read_list_expr(lith_st *L, char *start, char **end) list = p = L->nil; for (;;) { lex(L, *end, &t, end); - if (LITH_IS_ERR(L)) return NULL; + if (LITH_IS_ERR(L)) { + if (LITH_AT_END_NO_ERR(L)) + lith_simple_error(L, LITH_ERR_EOF, + "while reading a list"); + return NULL; + } if (*t == ')') return list; if (*t == '.' && (*end - t == 1)) { if (LITH_IS_NIL(p)) { -- cgit 1.4.1-2-gfad0