Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

Differing behavior of multi grammar rules with and without "multi" #3724

Open p6rt opened 9 years ago

p6rt commented 9 years ago

Migrated from rt.perl.org#124018 (status was 'open')

Searchable as RT124018$

p6rt commented 9 years ago

From @skids

In a grammar that uses a proto+parameterized multi, the "multi" is optional according to S05. However, the presence of the "multi" seems to prevent proper operation of this feature under certain circumstances​:

# perl6 -e 'grammar f { proto token g {*}; token g​:h\ { i* }; token g​:h\ { j* }; proto token l {*}; multi token l​:m\ { n* }; multi token l​:m\ { o* } }; f.parse("i", :rule\).say; f.parse("j", :rule\).say; f.parse("n", :rule\).say; f.parse("o", :rule\).say;' 「i」 「j」 「n」 (Any)

It seems to work fine in other circumstances. The same as above, but without the quantifiers yields​:

# perl6 -e 'grammar f { proto token g {*}; token g​:h\ { i }; token g​:h\ { j }; proto token l {*}; multi token l​:m\ { n }; multi token l​:m\ { o } }; f.parse("i", :rule\).say; f.parse("j", :rule\).say; f.parse("n", :rule\).say; f.parse("o", :rule\).say;' 「i」 「j」 「n」 「o」

p6rt commented 6 years ago

From @AlexDaniel

Still reproducible (2017.11, HEAD(5929887)). It does print Nil instead of (Any), but same thing. On 2015-03-08 09​:22​:25, bri@​abrij.org wrote​:

In a grammar that uses a proto+parameterized multi, the "multi" is optional according to S05. However, the presence of the "multi" seems to prevent proper operation of this feature under certain circumstances​:

# perl6 -e 'grammar f { proto token g {*}; token g​:h\ { i* }; token g​:h\ { j* }; proto token l {*}; multi token l​:m\ { n* }; multi token l​:m\ { o* } }; f.parse("i", :rule\).say; f.parse("j", :rule\).say; f.parse("n", :rule\).say; f.parse("o", :rule\).say;' 「i」 「j」 「n」 (Any)

It seems to work fine in other circumstances. The same as above, but without the quantifiers yields​:

# perl6 -e 'grammar f { proto token g {*}; token g​:h\ { i }; token g​:h\ { j }; proto token l {*}; multi token l​:m\ { n }; multi token l​:m\ { o } }; f.parse("i", :rule\).say; f.parse("j", :rule\).say; f.parse("n", :rule\).say; f.parse("o", :rule\).say;' 「i」 「j」 「n」 「o」

p6rt commented 6 years ago

The RT System itself - Status changed from 'new' to 'open'