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.

/Patrik Hägglund

2011/5/6 Carl Mäsak <cma...@gmail.com>:
> Patrik (>):
>> The following program works as I expect:
>>
>> grammar g {
>>  rule TOP {[a| ]+}
>>  rule ws {<blank>+}
>> }
>> g.parse('a a');
>> say "'$/'";
>>
>> gives me 'a a',
>>
>> but changing [a| ] into [ |a] gives me
>>
>> 'a'
>>
>> I suspect this is a problem in the rakudo implementation.
>
> Yes, but perhaps not as you expect. See "Nothing is illegal" at
> <http://perlcabal.org/syn/S05.html#Nothing_is_illegal>.
>
> In essence, /[ | a]/ should mean (and does in Rakudo) /a/, whereas /[
> a | ]/ should be a compile-time error.
>
> // Carl
>

Reply via email to