diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-24 08:01:12 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-24 08:01:12 -0800 |
commit | fd795adb279719bf77a7a6333b1e97500c454964 (patch) | |
tree | 48f2aebb97b35e67a483954f06dbf02500748d04 | |
parent | 251c670160fad9fc0febfa7dfd5ff1a7ba8a7308 (diff) | |
download | txr-fd795adb279719bf77a7a6333b1e97500c454964.tar.gz txr-fd795adb279719bf77a7a6333b1e97500c454964.tar.bz2 txr-fd795adb279719bf77a7a6333b1e97500c454964.zip |
* 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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | parser.y | 20 |
2 files changed, 24 insertions, 3 deletions
@@ -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. @@ -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); |