Skip Menu |
Report information
Id: 130911
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: lloyd.fourn [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: regex
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
From: Lloyd Fournier <lloyd.fourn [...] gmail.com>
Subject: [REGEX] bogus range o ** { 1..0 } succeeds
Date: Sat, 04 Mar 2017 09:08:53 +0000
Download (untitled) / with headers
text/plain 315b

my $i = 0;
say "ooo" ~~ / "o" ** {1..$i} / #-> 
「ooo」

It is impossible to match "one or more up to a maximum of zero" times. This should just fail to match. If you do a literal '1' without it does the right thing:

perl6 - e 'say "ooo" ~~ / "o" ** 1..0 /'

===SORRY!=== Error while compiling -e
Empty range

LL

Download (untitled) / with headers
text/plain 717b
Em Sat, 04 Mar 2017 01:09:20 -0800, lloyd.fourn@gmail.com escreveu: Show quoted text
> my $i = 0; > say "ooo" ~~ / "o" ** {1..$i} / #-> 「ooo」 > > It is impossible to match "one or more up to a maximum of zero" times. This > should just fail to match. If you do a literal '1' without it does the > right thing: > > perl6 - e 'say "ooo" ~~ / "o" ** 1..0 /' > > ===SORRY!=== Error while compiling -e > Empty range > > LL
even with literal 0, but inside of {} it doesn't work: $ ./perl6 -e 'say "ooo" ~~ / "o" ** {1..1} /' 「o」 $ ./perl6 -e 'say "ooo" ~~ / "o" ** {1..0} /' 「ooo」 $ ./perl6 -e 'say "ooo" ~~ / "o" ** 1..0 /' ===SORRY!=== Error while compiling -e Empty range at -e:1 ------> say "ooo" ~~ / "o" ** 1..0⏏ /
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 577b
On Sat, 04 Mar 2017 01:09:20 -0800, lloyd.fourn@gmail.com wrote: Show quoted text
> my $i = 0; > say "ooo" ~~ / "o" ** {1..$i} / #-> 「ooo」 > > It is impossible to match "one or more up to a maximum of zero" times. This > should just fail to match. If you do a literal '1' without it does the > right thing: > > perl6 - e 'say "ooo" ~~ / "o" ** 1..0 /' > > ===SORRY!=== Error while compiling -e > Empty range > > LL
Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/681d6be9742e7c0 Test: https://github.com/perl6/roast/commit/99c822abdeefbbaf0


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org