From 50c2dbed6f823a286d40a1378626467b09363cbb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 15 Jul 2014 20:56:48 -0700 Subject: * match.c (v_do, v_require): Set up and tear down environment frame, like other situations that evaluate TXR Lisp from the pattern language. Otherwise obscure things will go wrong. (h_do): Same as above, and additionally, add the forgotten call to install the bindings into the match context. --- ChangeLog | 8 ++++++++ match.c | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7573c2b..767c6151 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-07-15 Kaz Kylheku + + * match.c (v_do, v_require): Set up and tear down environment frame, + like other situations that evaluate TXR Lisp from the pattern language. + Otherwise obscure things will go wrong. + (h_do): Same as above, and additionally, add the forgotten + call to install the bindings into the match context. + 2014-07-15 Kaz Kylheku * match.c (h_eol): Fix broken horizontal @(eol). diff --git a/match.c b/match.c index 83aac757..2c6d2295 100644 --- a/match.c +++ b/match.c @@ -3583,8 +3583,10 @@ static val v_do(match_files_ctx *c) { spec_bind (specline, first_spec, c->spec); val args = rest(first_spec); + uw_env_begin; uw_set_match_context(cons(c->spec, c->bindings)); (void) eval_progn(args, make_env(c->bindings, nil, nil), specline); + uw_env_end; return next_spec_k; } @@ -3592,9 +3594,13 @@ static val v_require(match_files_ctx *c) { spec_bind (specline, first_spec, c->spec); val args = rest(first_spec); + val ret; + uw_env_begin; uw_set_match_context(cons(c->spec, c->bindings)); - if (!eval_progn(args, make_env(c->bindings, nil, nil), specline)) - return nil; + ret = eval_progn(args, make_env(c->bindings, nil, nil), specline); + uw_env_end; + if (!ret) + return ret; return next_spec_k; } @@ -3714,7 +3720,10 @@ static val h_do(match_line_ctx *c) { val elem = first(c->specline); val args = rest(elem); + uw_env_begin; + uw_set_match_context(cons(cons(c->specline, nil), c->bindings)); (void) eval_progn(args, make_env(c->bindings, nil, nil), elem); + uw_env_end; return next_spec_k; } -- cgit v1.2.3