diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-24 02:04:40 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-24 02:04:40 -0800 |
commit | 8e8e14991164f2ddd33cac040a68b155847fa724 (patch) | |
tree | b83800dee6f245f010247d3bbff17d9a588a9b3b /parser.y | |
parent | b6c15577ecc660959a1d7ec69653d386b9254e92 (diff) | |
download | txr-8e8e14991164f2ddd33cac040a68b155847fa724.tar.gz txr-8e8e14991164f2ddd33cac040a68b155847fa724.tar.bz2 txr-8e8e14991164f2ddd33cac040a68b155847fa724.zip |
Symbol macros.
* eval.c (top_smb, defsymacro_s, symacrolet_s): New global variables.
(lookup_symac, get_opt_param_syms, get_param_syms, op_defsymacro,
expand_symacrolet, make_var_shadowing_env): New static functions.
(expand_tree_cases, expand_catch_clause): Install shadowing environment
so lexical bindings hide any symbol macrolets.
(expand_place): Fix neglect to expand an atomic form, which breaks
symbol macros used as places.
(expand): Expand symbol macros, expand symacrolet binding forms.
Make sure symbol macros are shadowed in the lexical binding
constructs. Take advantage of return value of rlcp_tree in a
few places.
(macro_form_p): Support for symbol macros; bugfix: not handling
default argument.
(macroexpand_1): Streamlined, and support added for symbol macros.
(eval_init): Protect top_smb from gc. Create new hash, stored in
top_smb. Initialize defsymacro_s and symacrolet_s.
Register op_defsymacro.
* parser.y (rlcp_tree): Return the to form instead of useless t and nil.
* txr.1: Documented.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1153,15 +1153,14 @@ val rlset(val form, val info) val rlcp_tree(val to, val from) { - if (atom(to)) { - return nil; - } else { + val ret = to; + if (consp(to)) { if (!source_loc(to)) rlcp(to, from); for (; consp(to); to = cdr(to)) rlcp_tree(car(to), from); - return t; } + return ret; } static wchar_t char_from_name(const wchar_t *name) |