Thank you that has actually made it very clear on why some rules with []
work when others get into the loop.
It seemed a bit odd that something before [] would advance the cursor
when something after does not. Take two rules like:
pass2 @1[] @1
pass2 []@1 @1
Why should the first rule advance the cursor when the second does not.
I understand from you explaining how the internals work, but without
that internal workings knowledge it does not seem logical or intuitive
that before and after are handled differently.
May be this also could be a documentation improvement, add something
which states that the cursor will be moved to the position just after
the replacement brackets when a rule is applied.
Another small note, it might be worth being extremely precise in
terminology here. The term "replacement" might mean the brackets [] or
it may mean what you are replacing it with. So may be for the brackets
[] refer to them as the "replacement brackets" or the "replacement group".
Michael Whapples
On 06/01/2017 09:33, Bert Frees wrote:
Yes, it is like other translation rules. However, with both multipass and other translation rules, it is not the first match that is used, but rather the best match. Only one matching rule is used, the rest is ignored. Processing resumes at the first character after the replacement. This means that if the replacement starts at offset 0 and has length 0, the processing resumes at the same place which results in an endless loop.
2017-01-06 8:09 GMT+01:00 Dave Mielke <dave@xxxxxxxxx <mailto:dave@xxxxxxxxx>>:
I'm having trouble understanding when a multipass opcode (e.g.
pass2) moves on
to the next character. It doesn't seem to be like translation
rules where the
first one that matches is used, the rest are skipped, and
processing resumes at
the next character after the replacement.
Are they all always processed, or is the first one that matches
the only one
that's processed?
Where does processing resume after a match?
--
Dave Mielke | 2213 Fox Crescent | The Bible is the very
Word of God.
Phone: 1-613-726-0014 <tel:1-613-726-0014> | Ottawa, Ontario |
http://Mielke.cc/bible/
EMail: Dave@xxxxxxxxx | Canada K2A 1H7 | http://FamilyRadio.org/
For a description of the software, to download it and links to
project pages go to http://liblouis.org