summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-24 02:14:27 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-24 02:14:27 -0800
commit74dbd0dc965618dd574a74368439c5804d198346 (patch)
tree8b04c9c2b0ffc54d6e8803b82dc5a46af527b33e
parent8e8e14991164f2ddd33cac040a68b155847fa724 (diff)
downloadtxr-74dbd0dc965618dd574a74368439c5804d198346.tar.gz
txr-74dbd0dc965618dd574a74368439c5804d198346.tar.bz2
txr-74dbd0dc965618dd574a74368439c5804d198346.zip
* eval.c (expand_qquote): Bugfix. Was not handling an unquote
in the dotted position: (qquote x1 .. xn . (unquote form)), which looks like the structure (qquote x1 .. xn unquote form). Fixed by a hack: after recursively expanding the (unquote form) part (rest of the form), we check whether the unexpanded version has unquote at the front. If so, we know the expansion is just form, and use it to emit the suitable expansion.
-rw-r--r--ChangeLog10
-rw-r--r--eval.c4
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3345d35b..267ea79a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2014-02-24 Kaz Kylheku <kaz@kylheku.com>
+ * eval.c (expand_qquote): Bugfix. Was not handling an unquote
+ in the dotted position: (qquote x1 .. xn . (unquote form)),
+ which looks like the structure (qquote x1 .. xn unquote form).
+ Fixed by a hack: after recursively expanding the (unquote form)
+ part (rest of the form), we check whether the unexpanded
+ version has unquote at the front. If so, we know the expansion is just
+ form, and use it to emit the suitable expansion.
+
+2014-02-24 Kaz Kylheku <kaz@kylheku.com>
+
Symbol macros.
* eval.c (top_smb, defsymacro_s, symacrolet_s): New global variables.
diff --git a/eval.c b/eval.c
index e00dc879..95983441 100644
--- a/eval.c
+++ b/eval.c
@@ -2065,7 +2065,9 @@ static val expand_qquote(val qquoted_form, val menv)
if (atom(r_ex)) {
return rlcp(cons(append_s, cons(f_ex, r_ex)), qquoted_form);
} else {
- if (car(r_ex) == append_s)
+ if (consp(r) && car(r) == unquote_s)
+ r_ex = cons(r_ex, nil);
+ else if (car(r_ex) == append_s)
r_ex = cdr(r_ex);
return rlcp(cons(append_s, cons(f_ex, r_ex)), qquoted_form);
}