diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-07-31 17:31:20 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-07-31 17:37:10 -0700 |
commit | c7edf3a752bc2522589246ff64f5a00fb96315d6 (patch) | |
tree | 9c4b043f52ea673054ccf38bc51a8310360d220c /txr.1 | |
parent | bf1cc0077168d7c1efa903afb5aa782d071533b6 (diff) | |
download | txr-c7edf3a752bc2522589246ff64f5a00fb96315d6.tar.gz txr-c7edf3a752bc2522589246ff64f5a00fb96315d6.tar.bz2 txr-c7edf3a752bc2522589246ff64f5a00fb96315d6.zip |
txr-013 2009-09-30txr-013
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -21,7 +21,7 @@ .\"IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED .\"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -.TH txr 1 2009-09-09 "txr v. 012" "Text Extraction Utility" +.TH txr 1 2009-09-09 "txr v. 013" "Text Extraction Utility" .SH NAME txr \- text extractor .SH SYNOPSIS @@ -637,6 +637,10 @@ Treat the remaining query as a subquery unit, and search the lines of the input file until that subquery matches somewhere. A skip is also an anonymous block. +.IP @(trailer) +Treat the remaining query or subquery as a match for a trailing context. That +is to say, if the remainder matches, the data position is not advanced. + .IP @(some) Match some clauses in parallel. At least one has to match. @@ -804,6 +808,38 @@ be written instead: end @BEG_SYMBOL @(end) +.SS The Trailer directive + +The trailer directive introduces a trailing portion of a query or subquery +which matches input material normally, but in the event of a successful match, +does not advance the current position. This can be used, for instance, to +cause @(collect) to match partially overlapping regions. + +Example: + + @(collect) + @line + @(trailer) + @(skip) + @line + @(end) + +This script collects each line which has a duplicate somewhere later +in the input. Without the @(trailer) directive, this does not work properly +for inputs like: + + 111 + 222 + 111 + 222 + +Without @(trailer), the first duplicate pair constitutes a match which +spans over the 222. After that pair is found, the matching continues +after the second 111. + +With the @(trailer) directive in place, the collect body, on each +iteration, only consumes the lines matched prior to @(trailer). + .SS The Some, All, None and Maybe directives These directives combine multiple subqueries, which are applied at the same position in parallel. The syntax of all three follows this example: |