Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a double-colon "cut group" to the inside of a ratcheted expression causes it to backtrack in Rakudo #1475

Open
p6rt opened this issue Jan 20, 2010 · 6 comments
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules

Comments

@p6rt
Copy link

p6rt commented Jan 20, 2010

Migrated from rt.perl.org#72234 (status was 'open')

Searchable as RT72234$

@p6rt
Copy link
Author

p6rt commented Jan 20, 2010

From @masak

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.

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

From @bbkr

on Kiev build second test doesn't match, but say :​: is not implemented

perl6 -e 'say "abab" ~~ / (a :​: b)+​: ab / || "no match"'
===SORRY!===
:​: not yet implemented at line 1, near " b)+​: ab /"

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 13, 2011

From @bbkr

NOM​: same error as on Kiev

bbkr​:nom bbkr$ ./perl6 -e 'say "abab" ~~ / (a :​: b)+​: ab / || "no match"'
===SORRY!===
:​: not yet implemented at line 1, near " b)+​: ab /"

@p6rt p6rt added the regex Regular expressions, pattern matching, user-defined grammars, tokens and rules label Jan 5, 2020
@JJ
Copy link

JJ commented Nov 12, 2023

Still "not yet implemented". Maybe it's about time it was implemented, now that this has become the oldest ticket here?

@lizmat
Copy link
Contributor

lizmat commented Nov 12, 2023

Would be nice, but it looks to me that would require changes to the NQP regex engine, and I don't see that happening any time soon :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules
Projects
None yet
Development

No branches or pull requests

3 participants