diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-08 09:04:46 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-08 09:04:46 -0700 |
commit | d910f624a23e374004924f46541e6f99b48583c7 (patch) | |
tree | dc2fbcd3cdbc57bd9a606e5d3b9c30b55fd3b8d2 /txr.1 | |
parent | 16a1ef71a6877069f4814ac16aa5e7a85e9a2f11 (diff) | |
download | txr-d910f624a23e374004924f46541e6f99b48583c7.tar.gz txr-d910f624a23e374004924f46541e6f99b48583c7.tar.bz2 txr-d910f624a23e374004924f46541e6f99b48583c7.zip |
* match.c (mintimes_k, maxtimes_k): New keyword variables.
(match_line): Implemented :mintimes and :maxtimes, changing
the semantics of :times.
(match_files): Likewise.
(match_init): New keyword variables initialized.
* txr.1: Updated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -1540,14 +1540,15 @@ If it matches successfully, it is tried at the line following the entire extent of matched data, if there is one. Thus, the collected regions do not overlap. -The collect as a whole always succeeds, even if the subquery does not match at -any position, and even if the until/last clause does not match. That is to say, -a query will never fail for the reason that a collect didn't collect anything. +Unless certain keywords are specified, or unless the collect is explicitly +failed with @(fail), it always succeeds, even if it collects nothing, +and even if the until/last clause never finds a match. -If no until/last clause is specified, the collect is unbounded. It consumes the -entire data file. If any query material follows such the collect clause, it -will fail if it tries to match anything in the current file; but of course, it -is possible to continue matching in another file by means of @(next). +If no until/last clause is specified, and the collect is not limited +using parameters, the collect is unbounded. It consumes the entire data +file. If any query material follows such the collect clause, it will fail if it +tries to match anything in the current file; but of course, it is possible to +continue matching in another file by means of @(next). If an until/last clause is specified, the collection stops when that clause matches at the current position. @@ -1690,10 +1691,15 @@ used if these other two are not used. Thus: @a @(end) -means collect every other line starting with the current line. Two other -keywords are :lines and :times. The :lines parameter specifies the upper bound -on how many lines should be scanned by the collect, and :times specifies the -upper bound on how many times the collect can match. +means collect every other line starting with the current line. Several +other supported keywords are :times, :mintimes, :maxtimes and lines. +The shorthand :times N means the same thing as :mintimes N :maxtimes N. +These specify how many matches should be collected. If there are fewer +than mintimes matches, the collect fails. If maxtimes matches are collected, +collect stops collecting immediately. + +Finally, the :lines parameter specifies the upper bound on how many lines +should be scanned by the collect. .SS The Coll Directive @@ -1825,7 +1831,7 @@ solved with cases: The @(coll) directive takes most of the same parameters as @(collect). See the section Collect Keyword Parameters above. So for instance @(coll :gap 0) means that the collects must be -consecutive, and @(coll :times 2) means that (at most) two matches +consecutive, and @(coll :maxtimes 2) means that at most two matches will be collected. The :lines keyword does not exist, but there is an analogous :chars keyword. |