diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | match.c | 6 | ||||
-rw-r--r-- | txr.1 | 6 |
3 files changed, 20 insertions, 3 deletions
@@ -1,3 +1,14 @@ +014-01-10 Kaz Kylheku <kaz@kylheku.com> + + * 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. + 2014-01-10 Kaz Kylheku <kaz@kylheku.com> * configure: Generate HAVE_VALGRIND as #define-d to 1, rathern @@ -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)); @@ -4763,7 +4763,7 @@ The TXR language contains an embedded Lisp dialect called TXR Lisp. This language is exposed in TXR in three ways. -Firstly, in any situation that calls for an expression, a Lisp compound +Firstly, in any situation that calls for an expression, a Lisp expression can be used, if it is preceded by the @ symbol. The Lisp expression is evaluated and its value becomes the value of that expression. Thus, TXR directives are embedded in literal text using @, and Lisp expressions @@ -4785,6 +4785,10 @@ Bind variable a to the integer 4: @(bind a @(+ 2 2)) +Bind variable b to the standard input stream: + + @(bind a @*stdin*) + Define several Lisp functions using @(do): @(do |