> I find nothing in the spec that addresses this case specifically. >From the spec:
The new :s (:sigspace) modifier causes whitespace sequences to be considered "significant"; they are replaced by a whitespace matching rule, <.ws> I can't find any exception to this rule. Therefore, as I read it, every whitespace should be replaced by <.ws>. /Patrik Hägglund 2011/5/6 Carl Mäsak <[email protected]>: > 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]/, 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. > > The fact that Rakudo sometimes erroneously accepts such regexes helps > confuse matters a bit. The fact that /[ |a]/ is a legal special case > meaning /[a]/ helps confuse things a bit further. > > // Carl >
