summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-11-19 12:05:39 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-11-19 12:05:39 -0800
commit1f3d894dab47e0d2527adf7db0b74296f19f7b81 (patch)
treec1f427b2c9d03760e1563ae53302359b7dc3cdb4 /txr.1
parentd3ba0368d9c5012ca9405ac55a6d9a632fb0895a (diff)
downloadtxr-1f3d894dab47e0d2527adf7db0b74296f19f7b81.tar.gz
txr-1f3d894dab47e0d2527adf7db0b74296f19f7b81.tar.bz2
txr-1f3d894dab47e0d2527adf7db0b74296f19f7b81.zip
deffilter grows in power: it can take quasistrings.
* lib.c (cdr_f): New global variable. (funcall1, funcall2, funcall3, funcall4): Fix unterminated arguments in uw_throwf call by using uw_throw instead. (do_or): New static function. (orf): New function. (obj_init): gc_protect and initialize cdr_f. * lib.h (cdr_f, orf): Declared. * match.c (v_deffilter): Treat the table as forms to be evaluated which must reduce to strings, rather than literal strings. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.19
1 files changed, 6 insertions, 3 deletions
diff --git a/txr.1 b/txr.1
index 33f21df7..cd30c208 100644
--- a/txr.1
+++ b/txr.1
@@ -3564,9 +3564,10 @@ This directive's syntax is illustrated in this example:
The deffilter symbol must be followed by the name of the filter to be defined,
-followed by tuples of strings. Each tuple specifies one or more texts
-which are mapped to a replacement text. For instance, the following specifies
-a telephone keypad mapping from upper case letters to digits.
+followed by tuples of forms which evaluate to strings. Each tuple specifies one
+or more texts which are mapped to a replacement text. For instance, the
+following specifies a telephone keypad mapping from upper case letters to
+digits. Quasiliterals may be used.
@(deffilter alpha_to_phone ("E" "0")
("J" "N" "Q" "1")
@@ -3579,6 +3580,8 @@ a telephone keypad mapping from upper case letters to digits.
("L" "O" "P" "8")
("G" "H" "Z" "9"))
+ @(deffilter foo (`@a` `@b`) ("c" `->@d`))
+
Filtering works using a longest match algorithm. The input is scanned from left
to right, and the longest piece of text is identified at every character
position which matches a string on the left hand side, and that text is