diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-11-19 17:17:23 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-11-19 17:17:23 -0800 |
commit | 4ac284ddd4bbf4c3c02c0531795baf669bca4f54 (patch) | |
tree | b2f64edbcc4d174876763e1371ef655f18ba6b43 /txr.1 | |
parent | 1f3d894dab47e0d2527adf7db0b74296f19f7b81 (diff) | |
download | txr-4ac284ddd4bbf4c3c02c0531795baf669bca4f54.tar.gz txr-4ac284ddd4bbf4c3c02c0531795baf669bca4f54.tar.bz2 txr-4ac284ddd4bbf4c3c02c0531795baf669bca4f54.zip |
* match.c (v_deffilter): Even better. Just evaluate
the arguments individually. Now @(deffilter a b ..)
is possible where these evaluate to suitable
lists of strings.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -3564,10 +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 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. +followed by forms which evaluate to lists of strings. Each list must +be at least two elements long and 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. @(deffilter alpha_to_phone ("E" "0") ("J" "N" "Q" "1") @@ -3582,6 +3582,13 @@ digits. Quasiliterals may be used. @(deffilter foo (`@a` `@b`) ("c" `->@d`)) + @(bind x ("from" "to")) + @(bind y ("---" "+++")) + @(deffilter sub x y) + +The last deffilter above equivalent to +@(deffilter sub ("from" "to") ("---" "+++")). + 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 |