From fd795adb279719bf77a7a6333b1e97500c454964 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 24 Feb 2014 08:01:12 -0800 Subject: * 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. --- ChangeLog | 7 +++++++ parser.y | 20 +++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc335b54..9e10c324 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-02-24 Kaz Kylheku + + * 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 * lib.c (obj_print, obj_pprint): Render quasi-quote hash and 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); -- cgit v1.2.3