diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | eval.c | 4 | ||||
-rw-r--r-- | lib.c | 4 |
3 files changed, 15 insertions, 2 deletions
@@ -1,3 +1,12 @@ +2015-05-03 Kaz Kylheku <kaz@kylheku.com> + + Deal with bad quote syntax. + + * eval.c (op_quote): Throw error on bad syntax. + + * lib.c (obj_print, obj_pprint): Do not hide bad quote syntax + using ' notation; print it using ordinary notation. + 2015-05-01 Kaz Kylheku <kaz@kylheku.com> Move initialization calls to more suitable place. @@ -1102,6 +1102,10 @@ static val eval_prog1(val forms, val env, val ctx_form) static val op_quote(val form, val env) { + val d = cdr(form); + + if (!consp(d) || cdr(d)) + eval_error(form, lit("bad quote syntax"), nao); return second(form); } @@ -6700,7 +6700,7 @@ val obj_print(val obj, val out) { val sym = car(obj); - if (sym == quote_s) { + if (sym == quote_s && consp(cdr(obj)) && !(cdr(cdr(obj)))) { put_char(chr('\''), out); obj_print(second(obj), out); } else if (sym == sys_qquote_s) { @@ -6894,7 +6894,7 @@ val obj_pprint(val obj, val out) { val sym = car(obj); - if (sym == quote_s) { + if (sym == quote_s && consp(cdr(obj)) && !(cdr(cdr(obj)))) { put_char(chr('\''), out); obj_print(second(obj), out); } else if (sym == sys_qquote_s) { |