fix behaviour of parse errors

This commit is contained in:
Sami Samhuri 2011-04-22 12:44:37 -07:00
parent 824f0eb0e2
commit 9161ca8c5d
2 changed files with 3 additions and 1 deletions

View file

@ -75,6 +75,8 @@ static LakeVal *prompt_read(Env *env, char *prompt)
/* try to parse a naked call without parens
(makes the repl more palatable) */
LakeList *list = parse_naked_list(buf, strlen(buf));
if (!list) return NULL;
LakeVal *result;
/* naked call */

View file

@ -82,8 +82,8 @@ LakeList *parse_naked_list(char *s, size_t n)
LakeVal *val = _parse_expr(&ctx);
if (val == VAL(PARSE_ERR)) {
list_free(list);
list = NULL;
ctx.i = ctx.n;
return NULL;
}
list_append(list, val);
}