On 05/06/2011 02:10 PM, Carl Mäsak wrote:
> Patrik (>):
>> Your link seems to specifiy how empty patterns are illegal. However,
>> reading the :sigspace definition, I assume that rule {[ |a]+} is
>> eqivalent to token {[<.ws>|a]+}, which not contains any empty pattern.
> 
> I find nothing in the spec that addresses this case specifically.
> (Though I might have simply missed it.)
> 
> However, I expect *any* alternations on the form /[ |a]/ to simplify
> to just /[a]/,

Agreed.

> so I don't agree with your equivalence above. More
> generally, nowhere in Perl 6 regexes does a regex (or alternation
> alternative, or capture, or group, etc) containing *only* whitespace
> correspond to <.ws> -- instead, it's illegal.

Much to my surprise std disagrees:

14:24 < moritz> std: m/ /
14:24 <+p6eval> std 9f27365: OUTPUT«===SORRY!===␤Null pattern not
allowed at  /tmp/Ablb1Ce4Mi line 1:␤------> m/ ⏏/␤    expecting
quantifier␤Parse failed␤FAILED 00:01 113m␤»
14:24 < moritz> std: m:s/ /
14:24 <+p6eval> std 9f27365: OUTPUT«ok 00:01 113m␤»

And also in the aforementioned case:

14:07 < moritz> std: m:s/[a| ]/
14:08 <+p6eval> std 9f27365: OUTPUT«ok 00:01 113m␤»
14:08 < moritz> std: m/[a| ]/
14:08 <+p6eval> std 9f27365: OUTPUT«===SORRY!===␤Null pattern not
allowed at /tmp/VBaNc7c86G line 1:␤------> m/[a| ⏏]/␤    expecting any
of:␤   quantifier␤     regex atom␤Parse failed␤FAILED 00:01
                113m␤»

If that's intentional (and I'd find it very surprising if such a feature
slipped in accidentally), it needs explicit speccing.

Cheers,
Moritz

Reply via email to