diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-11-19 12:05:39 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-11-19 12:05:39 -0800 |
commit | 1f3d894dab47e0d2527adf7db0b74296f19f7b81 (patch) | |
tree | c1f427b2c9d03760e1563ae53302359b7dc3cdb4 /txr.1 | |
parent | d3ba0368d9c5012ca9405ac55a6d9a632fb0895a (diff) | |
download | txr-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.1 | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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 |