* Philip Hazel <ph10@hermes.cam.ac.uk> [2011-09-21 11:20]: > I've been thinking about this some more. My naive understanding > of *THEN is basically this: it is effectively just another way > of doing what (?>...) does, but with possibly simpler syntax > and the added feature of *THEN:NAME. The emphasis on > alternation is really a red herring. Thus, if you have > > A (*THEN) B > > (where A and B are complex patterns) the matching engine, > having passed (*THEN) and subsequently failed in B, no longer > backtracks into A. This would be the same: > > (?>A)B That is how I understand it as well. In which case the emphasis on alternation is not entirely a red herring, as the question it tries to address is that both (*THEN) and (*PRUNE) could be considered the closing paren of an atomic group which differ in where the opening paren is inferred to be (start of pattern vs start of group) – which makes the most practical difference inside alternations, where (*PRUNE) causes a very different effect from (*THEN). In most other cases the difference in matching is very much subtler. It occurs to me that “THEN” is really the wrong thing to call this predicate. It should be maybe “ASLONGAS”. That is A(*THEN)B translates to something like “match A as long as B also matches from that point on”. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>Thread Previous | Thread Next