|Subject:||[BUG] Adding a double-colon "cut group" to the inside of a ratcheted expression causes it to backtrack in Rakudo|
|Date:||Wed, 20 Jan 2010 16:42:45 +0100|
|To:||rakudobug [...] perl.org|
|From:||Carl Mäsak <cmasak [...] gmail.com>|
This be Rakudo db84bc on Parrot r43174. $ perl6 -e 'say "abab" ~~ / (ab)+: ab / || "no match"' no match $ perl6 -e 'say "abab" ~~ / (a :: b)+: ab / || "no match"' abab This is a PGE bug, but I don't know where else to submit PGE bugs, and they are expressed through Rakudo, so I'll submit it here. The first expression prints 'no match', and it should. This is because the ':' in the quantifier forbids the parenthesis group to backtrack into itself. It needs to backtrack into itself because it greedily ate both the 'ab' literals, when it should have saved one for dessert. The second expression should also print 'no match', for the exact same reasons. But it prints 'abab', which means it matches, which means it backtracks into the parenthesized submatch. It should do so no more than the first expression should -- adding '::' shouldn't change things.