diff options
-rw-r--r-- | match.c | 15 | ||||
-rw-r--r-- | txr.1 | 24 |
2 files changed, 36 insertions, 3 deletions
@@ -2398,6 +2398,7 @@ static val v_next(match_files_ctx *c) if (rest(first_spec)) { val args = rest(first_spec); val source = first(args); + val meta = nil; if (source == args_k) { if (rest(args)) { @@ -2427,6 +2428,15 @@ static val v_next(match_files_ctx *c) } } + if (consp(source)) { + val sym = car(source); + if (sym == var_s || sym == expr_s) + meta = t; + } + + if (opt_compat && opt_compat <= 124) + meta = t; + if (keywordp(first(args))) { source = nil; } else { @@ -2442,7 +2452,10 @@ static val v_next(match_files_ctx *c) val list_expr = cdr(assoc(list_k, alist)); val string_expr = cdr(assoc(string_k, alist)); val nothrow = cdr(assoc(nothrow_k, alist)); - val str = txeval(specline, source, c->bindings); + val str = if3(meta, + txeval(specline, source, c->bindings), + eval_with_bindings(source, specline, c->bindings, + specline)); if (!from_var && !source && !string_expr && !list_expr) sem_error(specline, lit("next: source required before keyword arguments"), nao); @@ -3071,7 +3071,7 @@ to \*(TX on the command line. If .meta source -is given, it must be string-valued expression which denotes an +is given, it must be string-valued Lisp expression which denotes an input source; it may be a string literal, quasiliteral or a string-valued variable. For instance, if variable .code A @@ -32444,7 +32444,7 @@ Collect lines from all files that are given as arguments on the command line. If there are no files, then read from standard input: .cblk - @(next @(open-files *args* *stdin*)) + @(next (open-files *args* *stdin*)) @(collect) @line @(end) @@ -37770,6 +37770,26 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code -C 103 selects the behaviors described below for version 105, but not those for 102. +.IP 124 +In \*(TX 124 and earlier versions, the +.code @(next) +directive didn't evaluate the +.meta source +argument as a Lisp expression, but as a \*(TX Pattern Language +expression. Lisp expressions thus had to be delimited by +.codn @ . +The current behavior is that the argument is treated as Lisp. +If the compatibility option is set to 124 or lower, the old behavior +is restored. However, even without the presence of the compatibility option, +if the +.meta source +argument is a meta-expression or meta-variable (denotes by the +.code @ +prefix in front of a compound expression or symbol, respectively) +it is also treated in the old way. This latter behavior is obsolescent +and will eventually disappear, and the compatibility option will be +the only way to get the old behavior. + .IP 123 In \*(TX 123 and earlier, the variable initialization forms of a .code for |