summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-12-26 20:14:13 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-12-26 20:14:13 -0800
commit837b0f15d86b21665fdf7c5d55cbe4ecd6d42ea4 (patch)
tree51014445b28a04de955cbdc8bd251538e464f8c0 /txr.1
parent5335d788dc601a50fc26319d39b21bdcaf1457b6 (diff)
downloadtxr-837b0f15d86b21665fdf7c5d55cbe4ecd6d42ea4.tar.gz
txr-837b0f15d86b21665fdf7c5d55cbe4ecd6d42ea4.tar.bz2
txr-837b0f15d86b21665fdf7c5d55cbe4ecd6d42ea4.zip
TXR quasiliterals and output vars treated as Lisp.
* eval.c (format_field): Function moved here from match.c, along with the introduction of a new behavior: if a meta-expr occurs among the modifiers, its constituent expression is evaluated in its place. This allows for @{a @[expr]} which was previously not allowed in Lisp quasiliterals, but worked in TXR quasiliterals due to the treatment of @ by txeval. (subst_vars): Static function turns external, so code in match.c can call it instead of the subst_vars in that module. For that purpose, it needs to take a filter argument and process filters, like the match.c subst_vars. (op_quasi_lit): Pass nil as filter argument to subst_vars. * eval.h (format_field, subst_vars): Declared. * match.c (format_field): Function removed, moved to eval.c and slightly changed. (subst_vars): Renamed to tx_subst_vars. By default, now just a wrapper for subst_vars. In compatibility mode, invokes the old logic. (do_txeval, do_output_line): Call tx_subst_vars rather than subst_vars. * match.h (format_field): Declaration removed. * parser.y (expr): Grammar production removed: no longer referenced. (o_var): Braced variable case now parsed as n_expr, and expanded as expr by default, since this is Lisp now. In compatibility mode, expanded using expand_meta. Also SYMTOK case must be subject to expansion; an output var can now be a symbol macro. (expand_meta): Expand a quasi-literal as Lisp, except in compatibility mode. * txr.1: Bit of a documentation update. Existing doc isn't totally clear.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.110
1 files changed, 8 insertions, 2 deletions
diff --git a/txr.1 b/txr.1
index 003ace07..19b9f58d 100644
--- a/txr.1
+++ b/txr.1
@@ -2555,8 +2555,7 @@ escape for encoding a literal
.code @
character. Quasiliterals support the full output variable
syntax. Expressions within variables substitutions follow the evaluation rules
-of \*(TL when the quasiliteral occurs in \*(TL, and the rules of
-the \*(TX pattern language when the quasiliteral occurs in the pattern language.
+of \*(TL. This hasn't always been the case: see the COMPATIBILITY section.
Quasiliterals can be split into multiple lines in the same way as ordinary
string literals.
@@ -38863,6 +38862,13 @@ 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 128
+Compatibility with \*(TX 128 or earlier brings back the behavior that
+expressions in quasiliterals are evaluated according to \*(TX evaluation
+rules for quasiliterals which occur in the \*(TX pattern language.
+Similarly, expressions in
+.code @(output)
+blocks are treated \*(TX pattern language expressions.
.IP 127
In versions of \*(TX until 127, the functions
.codn symbol-function ,