diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-12-26 20:30:22 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-12-26 20:30:22 -0800 |
commit | 4500f9d53feea9205c4c30743bb99e3a5f15703d (patch) | |
tree | ba0e308452e3bb8f3375a93ab23957e17421487e /txr.1 | |
parent | d1caae1ac6f393d0bc8cbcf62804dbac0033d133 (diff) | |
download | txr-4500f9d53feea9205c4c30743bb99e3a5f15703d.tar.gz txr-4500f9d53feea9205c4c30743bb99e3a5f15703d.tar.bz2 txr-4500f9d53feea9205c4c30743bb99e3a5f15703d.zip |
txr: allow variable to span vertical function.
* match.c (v_var_compat, v_var): New static functions.
(match_files): No longer recognize v_var specially; it is now
handled via vertical table.
(dir_tables_init): Register a vertical sys:var directive also
via v_var function.
(match_compat_fixup): New function.
* txr.c (compat): Call match_compat_fixup.
* tests/010/span-var.txr: New file.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -2494,7 +2494,7 @@ In the .mono .meti >> ( fun >> [ args ...]) .onom -form, the match extends over characters which +form, the match extends over lines or characters which are matched by the call to the function, if the call succeeds. Thus .code "@{x (y z w)}" @@ -2505,7 +2505,23 @@ text skipped over by .code "@(y z w)" is also bound to the variable .codn x . -See Functions below. +Except in one special case, the matching takes place horizontally within the +current line, and the spanned range of text is treated as a string. +The exception is that if the +.mono +.meti >> @{ bident >> ( fun >> [ args ...])} +.onom +appears as the only element of a line, and +.meta fun +has a binding as a vertical function, then the function is invoked in +the same manner as it would be by the +.mono +.meti >> @( fun >> [ args ...]) +.onom +syntax. Then the variable indicated by +.meta bident +is bound to the list of lines matched by the function call. +Pattern functions are described in the Functions section below. In the .meta number @@ -86652,6 +86668,21 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code "-C 103" selects the behaviors described below for version 105, but not those for 102. +.IP 272 +\*(TX 273 introduce a new feature into the pattern language: a pattern variable +of the form +.mono +.meti >> @{ bident >> ( fun >> [ args ...])} +.onom +matches multiple lines, if it appears as the only element of a query line, +and if +.meta fun +has a binding as a vertical pattern function. Prior to 273, this situation was +not given any special treatment; the vertical function +.meta fun +was called such that only one line of input is visible, and if it produced +a match, the variable was bound to that line. A compatibility value of 272 +or lower restores this behavior. .IP 265 Until \*(TX 265, the .code with-resources |