Update of bug #62264 (project groff):

                 Summary: string iteration handles escape sequences
inconsistently (want `for` request) => [troff] string iteration handles escape
sequences inconsistently (want `for` request)

    _______________________________________________________

Follow-up Comment #4:


> I had wondered idly if we needed a reverse iterator.

Straw-man interface:


.for str mac anything
.rfor str mac anything

Iterate through `mac` (rfor: backwards), automatically assigning each element
in turn to `str`, interpreting `anything` at each iteration.


Open questions:

1.  What to put in `str` if the iterator hits a newline?
2.  Support something like Python's "StopIteration"?  Since we have no
exception mechanism, maybe just set a new read-only register \n[.stop] to
indicate that traversal was complete.  Might not be necessary; since I plan to
support conditional blocks and `break` (and `continue`) inside `for` and
`rfor` anyway, any logic that would prematurely exit the loop can set its own
register to indicate this.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62264>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/


Reply via email to