Closed p6rt closed 9 years ago
Rakudo r35221:
regex t1 { '(' ~ ')' 'ab' }
'x(ab' !~~ m/\
The regex match throws an exception because the final ')' isn't found anywhere. According to Larry, it shouldn't: http://irclog.perlgeek.de/perl6/2009-01-08#i_816425
This is tested in t/spec/S05-metachars/tilde.t (which I hope to enhance soon).
Cheers, Moritz
-- Moritz Lenz http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/
Rakudo r35221:
regex t1 { '(' ~ ')' 'ab' }
'x(ab' !~~ m/\
The regex match throws an exception because the final ')' isn't found anywhere. According to Larry, it shouldn't: http://irclog.perlgeek.de/perl6/2009-01-08#i_816425
This is tested in t/spec/S05-metachars/tilde.t (which I hope to enhance soon).
Cheers, Moritz
-- Moritz Lenz http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/
\
@coke - Status changed from 'new' to 'open'
\
After discussion with jnthn at OSDC.no, here's what we propose:
In the regex engine, the default FAILGOAL behavior should be to simply fail/backtrack. This would be the default behavior for (rakudo) Cursor as well.
Grammars that wish to have the generate-an-exception behavior can override FAILGOAL to do so. The HLL::Grammar class (in NQP) will do this, meaning that Rakudo's grammar will still inherit/retain the throw-an-exception behavior.
Part of our reasoning (which may be faulty) for this approach is that it's relatively easy to override FAILGOAL in a grammar but harder to do so for regexes that aren't in a grammar. In the latter case (regex), it's more likely that you want simple backtracking rather than the "throw an error message", so that should be the default.
I propose to clean up the FAILGOAL API in NQP and Rakudo, then update S05 to match. Any objections or reactions would be welcomed.
Pm
On Mon May 11 05:26:45 2015, pmichaud wrote:
After discussion with jnthn at OSDC.no, here's what we propose:
In the regex engine, the default FAILGOAL behavior should be to simply fail/backtrack. This would be the default behavior for (rakudo) Cursor as well.
Grammars that wish to have the generate-an-exception behavior can override FAILGOAL to do so. The HLL::Grammar class (in NQP) will do this, meaning that Rakudo's grammar will still inherit/retain the throw-an-exception behavior.
Part of our reasoning (which may be faulty) for this approach is that it's relatively easy to override FAILGOAL in a grammar but harder to do so for regexes that aren't in a grammar. In the latter case (regex), it's more likely that you want simple backtracking rather than the "throw an error message", so that should be the default.
This sounds very sane. +1
On Tue May 12 06:47:23 2015, masak wrote:
On Mon May 11 05:26:45 2015, pmichaud wrote:
After discussion with jnthn at OSDC.no, here's what we propose:
In the regex engine, the default FAILGOAL behavior should be to simply fail/backtrack. This would be the default behavior for (rakudo) Cursor as well.
Grammars that wish to have the generate-an-exception behavior can override FAILGOAL to do so. The HLL::Grammar class (in NQP) will do this, meaning that Rakudo's grammar will still inherit/retain the throw-an-exception behavior.
Part of our reasoning (which may be faulty) for this approach is that it's relatively easy to override FAILGOAL in a grammar but harder to do so for regexes that aren't in a grammar. In the latter case (regex), it's more likely that you want simple backtracking rather than the "throw an error message", so that should be the default.
This sounds very sane. +1
TimToaday++ approved also. I did the changes to implement the new semantics, and unfudged the existing tests for this ticket.
@jnthn - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#62086 (status was 'resolved')
Searchable as RT62086$