diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-07-15 20:56:48 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-07-15 20:56:48 -0700 |
commit | 50c2dbed6f823a286d40a1378626467b09363cbb (patch) | |
tree | 4dffe3da84a44476c5b6cc291dc655c5bb9ad066 | |
parent | 9b763824a241ce6345377325c688d8769fc378bd (diff) | |
download | txr-50c2dbed6f823a286d40a1378626467b09363cbb.tar.gz txr-50c2dbed6f823a286d40a1378626467b09363cbb.tar.bz2 txr-50c2dbed6f823a286d40a1378626467b09363cbb.zip |
* 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.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | match.c | 13 |
2 files changed, 19 insertions, 2 deletions
@@ -1,5 +1,13 @@ 2014-07-15 Kaz Kylheku <kaz@kylheku.com> + * 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 <kaz@kylheku.com> + * match.c (h_eol): Fix broken horizontal @(eol). It should be returning next_spec_k, rather than bindings, which indicate a complete match. @@ -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; } |