summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-18 17:43:56 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-18 17:43:56 -0800
commitd14ddd48c53f3d9ec960782c75f657a627456d22 (patch)
treef966df8f17c1a532a41ffa7c749edb0fd95418f5 /txr.1
parent3b1e713d392d607a37e9f6d1520c4f9f584d014d (diff)
downloadtxr-d14ddd48c53f3d9ec960782c75f657a627456d22.tar.gz
txr-d14ddd48c53f3d9ec960782c75f657a627456d22.tar.bz2
txr-d14ddd48c53f3d9ec960782c75f657a627456d22.zip
Allow braced output variables to actually be arbitrary substitutions.
* eval.c (subst_vars): Treat the variable as an arbitrary expression rather than just a symbol. * match.c (subst_vars): Likewise. * parser.y (o_var): Further simplification. The first item in an output var is an expr and not an IDENT. * txr.1: Updated. * txr.vim: Likewise.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.117
1 files changed, 17 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 79943997..98a1387a 100644
--- a/txr.1
+++ b/txr.1
@@ -3334,6 +3334,8 @@ for the output clause. The syntax for this is @(NAME :filter <filterspec>}.
The filter specification syntax is the same as in the output clause.
See Output Filtering below.
+.SS Output Variables: Indexing
+
Additional syntax is supported in output variables that is does not appear
in pattern matching variables.
@@ -3367,6 +3369,21 @@ The above produces the text "b,c" in a field 10 spaces wide. The [1..3]
argument extracts a range of a; the "," argument specifies an alternate
separator string, and 10 specifies the field width.
+.SS Output Substitutions
+
+The brace syntax has another syntactic and semantic extension. In place
+of the symbol, an expression may appear. The value of that expression
+is substituted.
+
+Example:
+
+ @(bind a "foo")
+ @(output)
+ @{`@a:` -10}
+
+Here, the quasiliteral expression `@a:` is evaluated, producing the string
+"foo:". This string is printed right-adjusted in a 10 character field.
+
.SS The Repeat Directive
The repeat directive is generates repeated text from a ``boilerplate'',