diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-30 12:26:41 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-30 12:26:41 -0800 |
commit | ac08d22c2b916fbd88c938569e0cd6af488b7a67 (patch) | |
tree | 845a929d332f67cc7ec6bd5196b3acf3d52f69b7 /txr.1 | |
parent | 0b81b8b4c39b6c60cbbe8de5a6a785beb43c3dbb (diff) | |
download | txr-ac08d22c2b916fbd88c938569e0cd6af488b7a67.tar.gz txr-ac08d22c2b916fbd88c938569e0cd6af488b7a67.tar.bz2 txr-ac08d22c2b916fbd88c938569e0cd6af488b7a67.zip |
* match.c (counter_k): New keyword symbol variable.
(do_output_line): Process new :counter argument of rep.
(do_output): Ditto, for repeat.
(syms_init): Intern new keyword symbol.
* match.h (counter_k): Declared.
* parser.l (REPEAT, REP): Lexical syntax changed to
allow arguments.
* parser.y (repeat_rep_helper): Takes extra argument, representing
the repeat/rep args. This is inserted into the second position
of the output list.
(repeat_clause, rep_elem): Extract repeat/rep arguments and
pass to repeat_rep_helper.
(yybadtoken): Do not put quotes around the word "number".
* txr.1: Updated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -3295,9 +3295,11 @@ like this: @(end) Repeat has four types of special clauses, any of which may be -specified with empty contents, or omitted entirely. They are explained +specified with empty contents, or omitted entirely. They are described below. +Repeat takes arguments, also described below. + All of the material in the main clause and optional clauses is examined for the presence of variables. If none of the variables hold lists which contain at least one item, then no output is performed, @@ -3381,6 +3383,14 @@ are none, or none of them activate, then @(last) is considered. If none of those clauses are present or apply, then the repetition is processed using the main clause. +Repeat supports an optional keyword argument: + + @(repeat [:counter <symbol>]) + +This designates a symbol which will behave as an integer variable over the +scope of the clauses inside the repeat. The variable provides access to the +reptition count, starting at zero, incrementing with each repetition. + .SS Nested Repeats If a repeat clause encloses variables which holds multidimensional lists, |