diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-01-10 07:39:07 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-01-10 07:39:07 -0800 |
commit | af2af7a4ed4321f955251f9da13a161a1e8940b3 (patch) | |
tree | 69f5864b4fbb97c0b8ea4fcb3828d1b1779c3753 /match.c | |
parent | 7649cd2cc9165ad8019d9d33af697927fd2e64b4 (diff) | |
download | txr-af2af7a4ed4321f955251f9da13a161a1e8940b3.tar.gz txr-af2af7a4ed4321f955251f9da13a161a1e8940b3.tar.bz2 txr-af2af7a4ed4321f955251f9da13a161a1e8940b3.zip |
* match.c (do_txeval): Lift an annoying restriction in the pattern
language's expression evaluator. Whereas TXR Lisp expressions can be
used int the pattern language, preceded by @, it was not possible
to evaluate TXR Lisp variables this way. So instead of @var,
some clumsy trick had to be used like @(identity var). This is not
necessary any more. Code like @(next @*stdin*) will now work.
* txr.1: Updated.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1432,8 +1432,10 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound) } 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); + uw_env_begin; + uw_set_match_context(cons(spec, bindings)); + ret = eval(second(form), make_env(bindings, nil, nil), form); + uw_env_end; } else if (first(form) == expr_s) { uw_env_begin; uw_set_match_context(cons(spec, bindings)); |