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
backtracking in LTM alternation in ratchet mode fails #3704
Comments
From beasley@web.desay "asdfEnd" ~~ /:ratchet [ xyz | .+! ] End /; I would expect this to match. I also tested (and work as I'd expect): |
From beasley@web.deAs expressed by perlpilot++ and some others, having say "asdfEnd" ~~ /:ratchet [ xyz | .+! ] End /; all fail might also be a way to harmonize the behavior. |
From beasley@web.de(I tried adding this comment about a month ago, but failed hard. Thus another As expressed by perlpilot++ and some others, having say "asdfEnd" ~~ /:ratchet [ xyz | .+! ] End /; all fail might also be a way to harmonize the behavior. |
From @smlsThe way I understand it, following S02 strictly should mean the first two should fail, but the third one should match. Think of the regex as an expression made up of nested operations. 1) In the case of /:r [ xyz | .+! ] End/, the last operation before the "End" is an alternation. The :ratchet is supposed to¹ prevent backtracking into alternations, thus this should fail. 2) In the case of /:r [ xyz || .+! ] End/, the same reasoning applies - except if the phrasing¹ in S05 is imprecise and it actually only meant for `|` alternations to be affected by :ratchet but not `||` alternations. 3) In the case of /:r [ .+! ] End /, the last operation before the "End" is the + quantifier. (The brackets are not an operator - they only disambiguate precedence, like parens do in normal Perl 6 code.) If this interpretation is correct, it would mean that the actual bug is not that the `|` version fails to backtrack, but that the `||` version does backtrack when it shouldn't. ¹⁾ See this paragraph <http://design.perl6.org/S05.html#line_621> in S05 which explicitly mentions alternations. |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#123934 (status was 'open')
Searchable as RT123934$
The text was updated successfully, but these errors were encountered: