From 21eb30046e3993ffaf61fcb050702aaeb688fb8c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 6 Jan 2012 20:37:10 -0800 Subject: * match.c (fuzz_s): New symbol variable. (v_fuzz): New static function. (syms_init): fuzz_s initialized. (dir_tables_init): v_fuzz entered into v_directive_table. * txr.1: Documented @(fuzz). --- txr.1 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 69f1cc5e..20cb876d 100644 --- a/txr.1 +++ b/txr.1 @@ -1129,6 +1129,10 @@ Treat the remainder of the input as one big string, and apply the following query line to that string. The newline characters (or custom separators) appear explicitly in that string. +.IP @(fuzz) +The fuzz directive, inspired by the patch utility, specifies a partial +match for some lines. + .IP @(some) Multiple clauses are each applied to the same input. Succeeds if at least one of the clauses matches the input. The bindings established by earlier @@ -1620,6 +1624,25 @@ Example: @(coll)@{token /[^:]*/}:@(end) @(end) +.SS The Fuzz Directive + +The fuzz directive allows for an imperfect match spanning a set number of +lines. It takes two arguments, both expressions that should evaluate +to integers: + + @(fuzz m n) + ... + +This expresses that over the next n query lines, the matching strictness +is relaxed a little bit. Only m out of those n lines have to match. +Afterward, the rest of the query follows normal, strict processing. + +In the degenerate situation that there are fewer than n query lines following +the fuzz directive, then m of them must succeed nevertheless. (If there +are fewer than m, then this is impossible.) + +.B TXR's + .SS The Some, All, None, Maybe, Cases and Choose directives These directives, called the parallel directives, combine multiple subqueries, -- cgit v1.2.3