You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# I believe this is a known NYI but it is probably about time there was
# an RT for it.
# Rakudo's proto+multi grammar rules don't function as specced. They
# should be equivalent to an '|' alternative.
# These two grammars should produce identical results
grammar g1 {
proto token m {*}
multi token m:sep<2> { '==' }
multi token m:sep<1> { '=' }
multi token m:sep<0> { '' }
token TOP { d <m> foo }
}
grammar g2 {
proto token m {*}
multi token m:sep<0> { '' }
multi token m:sep<1> { '=' }
multi token m:sep<2> { '==' }
token TOP { d <m> foo }
}
g1.parse('d==foo').say; # 「d==foo」 m => 「==」
g1.parse('d=foo').say; # 「d=foo」 m => 「=」
g1.parse('dfoo').say; # 「dfoo」 m => 「」
# Also this:
perl6 -e 'grammar g { proto regex { f {*} g } }'
===SORRY!=== Error while compiling -e
Proto regex body must be {*} (or <*> or <...>, which are deprecated)
at -e:1
------> grammar g { proto regex ⏏{ f {*} g } }
...where the design docs say:
The proto calls into the subdispatcher when it sees a * that cannot be a quantifier and is the only thing in its block. Therefore you can put items before and after the subdispatch by putting the * into curlies:
Migrated from rt.perl.org#125374 (status was 'new')
Searchable as RT125374$
The text was updated successfully, but these errors were encountered: