summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSudipto Mallick <smlckz.dev@gmail.com>2021-03-13 14:06:10 +0000
committerSudipto Mallick <smlckz.dev@gmail.com>2021-03-13 14:06:10 +0000
commit5cf9c90f53b79ed147eb28377a5a94e2abdc5df8 (patch)
treed2b66c5fb9999727c634777d67b9a1d9a6acb27f
parent2cf00dc4ccfbb6bf1de8c4e6894cfb7908601685 (diff)
downloadlith-5cf9c90f53b79ed147eb28377a5a94e2abdc5df8.tar.gz
add error for unclosed lists HEAD main
-rw-r--r--lith.c7
1 files changed, 6 insertions, 1 deletions
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)) {