diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-05-17 07:08:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-05-17 07:08:01 -0700 |
commit | 5d0bccf9d20b653136b5afc46e7af6ce21ba414f (patch) | |
tree | 3087a416a21cbdbf0976f20b5f8d6f655d95d7b8 | |
parent | adbf196ebddbff4b85d96bac523df231b46181e1 (diff) | |
download | txr-5d0bccf9d20b653136b5afc46e7af6ce21ba414f.tar.gz txr-5d0bccf9d20b653136b5afc46e7af6ce21ba414f.tar.bz2 txr-5d0bccf9d20b653136b5afc46e7af6ce21ba414f.zip |
doc: incorrect precedence of repeat special clauses.
* txr.1: The precedence among the repeat clauses is documented
incorrectly: the @(mod) clause has a lower precedence than
modlast and last. Redocumenting this area for better clarity,
and mentioning why @(empty) isn't in the precedence list.
This issue was reported by Paul A. Patience with a patch,
which I reworked.
-rw-r--r-- | txr.1 | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -9254,28 +9254,40 @@ and if it is the last repetition. .PP The precedence among the clauses which take an iteration is: -.codn "single > first > mod > modlast > last > main" . -That is if two or more of these +.codn "single > first > modlast > last > mod > main" . +That is, whenever two or more of these clauses can apply to a repetition, then the leftmost one in this precedence -list applies. For instance, if there is just a single repetition, then any of -these special clause types can apply to that repetition, since it is the only -repetition, as well as the first and last one. In this situation, if there is a +list will be selected. It is possible for all these clauses to be viable +for processing the same repetition. If a +.code repeat +occurs which has only one repetition, then that repetition is simultaneously +the first, only and last repetition. Moreover, it also matches +.code "(mod 0 m)" +and, because it is the last repetition, it matches +.codn "(modlast 0 m)" . +In this situation, if there is a .code @(single) -clause present, then the repetition is processed using that clause. -Otherwise, if there is a +clause present, then the repetition shall be processed using that +clause. Otherwise, if there is a .code @(first) -clause present, that clause is used. Failing +clause present, that clause is activated. Failing that, -.code @(mod) -is used if there is such a clause and its numeric conditions -are satisfied. If there isn't, then .code @(modlast) -clauses are considered, and if there -are none, or none of them activate, then +is used if there is such a clause, featuring an +.code n +argument of zero. If there isn't, then the .code @(last) -is considered. Finally if none -of all these clauses are present or apply, then the repetition is processed -using the main clause. +clause is considered, if present. Otherwise, the +.code @(mod) +clause is considered if present with an +.code n +argument of zero. Otherwise, none of these clauses are present or applicable, +and the repetition is processed using the main clause. + +.code @(empty) +clause does not appear in the above precedence list because it is mutually +exclusive with respect to the others; it is processed only when there are no +iterations, in which case even the main clause isn't active. Repeat supports arguments. |