# New Ticket Created by "Brian S. Julin" # Please include the string: [perl #125374] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=125374 >
# 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 => 「」 g2.parse('d==foo').say; # (Any) g2.parse('d=foo').say; # (Any) g2.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: proto token foo { <prestuff> {*} <poststuff> }