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.
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
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.
/Patrik Hägglund
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,
The rule about empty (sub-)regexes being illegal is applied before the
rule about everywhitespace being replaced by .ws.
Where is that specified?
2011/5/6 Carl Mäsak cma...@gmail.com:
Patrik ():
I find nothing in the spec that addresses this case specifically.
From the spec:
The new :s
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
A side note:
The fact that /[ |a]/ is a legal special case
meaning /[a]/ helps confuse things a bit further.
Where is this special case specified?
2011/5/6 Carl Mäsak cma...@gmail.com:
Patrik ():
I find nothing in the spec that addresses this case specifically.
From the spec:
The new :s
Carl (), Patrik ():
The fact that /[ |a]/ is a legal special case
meaning /[a]/ helps confuse things a bit further.
Where is this special case specified?
http://perlcabal.org/syn/S05.html#line_2479
// Carl