summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-24 02:04:40 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-24 02:04:40 -0800
commit8e8e14991164f2ddd33cac040a68b155847fa724 (patch)
treeb83800dee6f245f010247d3bbff17d9a588a9b3b /parser.y
parentb6c15577ecc660959a1d7ec69653d386b9254e92 (diff)
downloadtxr-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.y7
1 files changed, 3 insertions, 4 deletions
diff --git a/parser.y b/parser.y
index 819630b9..3ea01e43 100644
--- a/parser.y
+++ b/parser.y
@@ -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)