summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-25 16:46:36 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-25 16:46:36 -0800
commit306d30c4b652fc3811d0a82b59d0cc5a8b58cfdf (patch)
treed332cc104349c082003e2aeedebf25beca6a6c78 /match.c
parent4a1479685d26d06d6857096ae2f86708e8a60cf4 (diff)
downloadtxr-306d30c4b652fc3811d0a82b59d0cc5a8b58cfdf.tar.gz
txr-306d30c4b652fc3811d0a82b59d0cc5a8b58cfdf.tar.bz2
txr-306d30c4b652fc3811d0a82b59d0cc5a8b58cfdf.zip
Bug #34652
* match.c (do_txeval): Establish a dynamic env frame around evaluation of quasiliteral and around embedded TXR Lisp expression (which may contain quasiliterals) and stick the bindings there via set_match_context. This way if filte functions are invoked through a quasiliteral, they can see bindings.
Diffstat (limited to 'match.c')
-rw-r--r--match.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/match.c b/match.c
index 08281050..855cdd4d 100644
--- a/match.c
+++ b/match.c
@@ -1374,14 +1374,20 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound)
}
} else if (consp(form)) {
if (first(form) == quasi_s) {
+ uw_env_begin;
+ uw_set_match_context(cons(spec, bindings));
ret = cat_str(subst_vars(rest(form), bindings, nil), nil);
+ uw_env_end;
} else if (regexp(car(form))) {
ret = form;
} else if (first(form) == var_s) {
sem_error(spec, lit("metavariable @~s syntax cannot be used here"),
second(form), nao);
} else if (first(form) == expr_s) {
+ uw_env_begin;
+ uw_set_match_context(cons(spec, bindings));
ret = eval(rest(form), make_env(bindings, nil, nil), form);
+ uw_env_end;
} else {
ret = mapcar(curry_123_2(func_n3(txeval), spec, bindings), form);
}