diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-05-03 21:34:14 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-05-03 21:34:14 -0700 |
commit | c6cd8acac9f6c6916aded21ea1e82d430036d04d (patch) | |
tree | 357ea3ea2a9c19cba725c20a8a16423a150bcf26 | |
parent | 251546a2204692c62cb51bee44c3a7601d82b83b (diff) | |
download | txr-c6cd8acac9f6c6916aded21ea1e82d430036d04d.tar.gz txr-c6cd8acac9f6c6916aded21ea1e82d430036d04d.tar.bz2 txr-c6cd8acac9f6c6916aded21ea1e82d430036d04d.zip |
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.
-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) { |