Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single named match does not work with hyper (».Str) #4715

Closed
p6rt opened this issue Nov 6, 2015 · 4 comments
Closed

Single named match does not work with hyper (».Str) #4715

p6rt opened this issue Nov 6, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Nov 6, 2015

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

Searchable as RT126574$

@p6rt
Copy link
Author

p6rt commented Nov 6, 2015

From bescirn@gmail.com

m​: grammar G {rule TOP {<G1>}; token G1 {A}}; my $g =
G.parse("A");  say $g<G1>».Str

rakudo-moar c880f1​: OUTPUT«()»

See​: http://irclog.perlgeek.de/perl6/2015-11-05#i_11492065

and subsequent discussion.

@p6rt
Copy link
Author

p6rt commented Oct 3, 2017

From @AlexDaniel

Interesting.

On 2015-11-05 16​:13​:33, bescirn@​gmail.com wrote​:

m​: grammar G {rule TOP {<G1>}; token G1 {A}}; my $g =
G.parse("A");  say $g<G1>».Str

rakudo-moar c880f1​: OUTPUT«()»

See​: http://irclog.perlgeek.de/perl6/2015-11-05#i_11492065

and subsequent discussion.

@p6rt
Copy link
Author

p6rt commented Oct 3, 2017

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

@raiph
Copy link

raiph commented Aug 22, 2021

The filer's title is misleading. It's not about named matches. The same issue arises with positional matches:

grammar G {rule TOP { (A) } }
my $g = G.parse("A");
say $g[0].Str;  # A
say $g[0]».Str; # ()

The filer's confusion/expectation was that a hyper would/should fall back to treating a capture as a list of that capture if it had no (positional) sub captures. I can see why, but such a fallback would be awful.

This might arguably belong as a doc issue, but I don't think so, so I'm not going to file one.

@raiph raiph closed this as completed Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants