summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--parser.y20
2 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index cc335b54..9e10c324 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-02-24 Kaz Kylheku <kaz@kylheku.com>
+ * parser.y (modifiers): Bugfix: list element not subject to expansion
+ of Lisp forms denoted by @.
+ (expand_meta): Bugfix: failure to expand vars, which can be
+ symbol macros now.
+
+2014-02-24 Kaz Kylheku <kaz@kylheku.com>
+
* lib.c (obj_print, obj_pprint): Render quasi-quote hash and
vector literals using their original notation.
diff --git a/parser.y b/parser.y
index 848670e5..d7416f36 100644
--- a/parser.y
+++ b/parser.y
@@ -666,7 +666,8 @@ modifiers : NUMBER { $$ = cons($1, nil); }
| regex { $$ = cons(cons(regex_compile(rest($1), nil),
rest($1)), nil);
rlcp($$, $1); }
- | list { $$ = cons($1, nil); }
+ | list { $$ = rlcp(cons(expand_meta($1, nil),
+ nil), $1); }
;
o_var : SYMTOK { $$ = list(var_s, sym_helper($1, nil), nao);
@@ -1122,13 +1123,26 @@ static val choose_quote(val quoted_form)
static val expand_meta(val form, val menv)
{
+ val sym;
+
if (atom(form))
return form;
menv = default_arg(menv, make_env(nil, nil, nil));
- if (car(form) == expr_s)
- return cons(expr_s, expand(rest(form), menv));
+ if ((sym = car(form)) == expr_s) {
+ val exp_x = expand(rest(form), menv);
+ if (!bindable(exp_x))
+ return cons(sym, exp_x);
+ return cons(var_s, cons(exp_x, nil));
+ }
+
+ if (sym == var_s) {
+ val var_x = expand(second(form), menv);
+ if (!bindable(var_x))
+ return cons(expr_s, var_x);
+ return cons(var_s, cons(var_x, nil));
+ }
{
list_collect_decl (out, ptail);