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

Flattening into named arguments does not happen from within rules #2783

Closed
p6rt opened this issue Jun 7, 2012 · 4 comments
Closed

Flattening into named arguments does not happen from within rules #2783

p6rt opened this issue Jun 7, 2012 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jun 7, 2012

Migrated from rt.perl.org#113544 (status was 'resolved')

Searchable as RT113544$

@p6rt
Copy link
Author

p6rt commented Jun 7, 2012

From kristofbogaerts@gmail.com

When feeding this code to rakudo, niecza, nqp​:

my grammar G {
method s_m(*%n) { say(%n<a>, %n<b>, %n<c>) }
token TOP { <s_m(|hash(​:a<1>, :c<3>), :b<2>)> }
}
G.s_m(|hash(​:a<1>, :c<3>), :b<2>);
G.parse('');

The following happens​:

rakudo e75a0a​: OUTPUT«123␤Too many positional parameters passed; got 2 but
expected 1␤ in method s_m at /tmp/WoccMCN4lv​:1␤ in regex TOP at
/tmp/WoccMCN4lv​:1␤ in method parse at src/gen/CORE.setting​:9647␤ in block
<anon> at /tmp/WoccMCN4lv​:1␤␤»

niecza v18-5-g556574c​: OUTPUT«123␤123␤Unhandled exception​: Submatch to be
bound to s_m returned a Bool instead of a Cursor, violating the submatch
protocol.␤ at /tmp/UohDQXuKbo line 1 (G.TOP @​ 6) ␤ at
/home/p6eval/niecza/lib/CORE.setting line 2884 (Grammar.parse @​ 5) ␤ at
/tmp/UohDQX

nqp​: OUTPUT«123␤too many positional arguments​: 2 passed, 1 expected␤current
instr.​: 's_m' pc 375 ((file unknown)​:151102171) (/tmp/A02sifbAgA​:1)␤»

Niecza has the correct answer here, I believe.

@p6rt
Copy link
Author

p6rt commented Oct 6, 2015

From @jnthn

On Thu Jun 07 11​:23​:08 2012, kristofbogaerts@​gmail.com wrote​:

When feeding this code to rakudo, niecza, nqp​:

my grammar G {
method s_m(*%n) { say(%n<a>, %n<b>, %n<c>) }
token TOP { <s_m(|hash(​:a<1>, :c<3>), :b<2>)> }
}
G.s_m(|hash(​:a<1>, :c<3>), :b<2>);
G.parse('');

The following happens​:

rakudo e75a0a​: OUTPUT«123␤Too many positional parameters passed; got 2 but
expected 1␤ in method s_m at /tmp/WoccMCN4lv​:1␤ in regex TOP at
/tmp/WoccMCN4lv​:1␤ in method parse at src/gen/CORE.setting​:9647␤ in block
<anon> at /tmp/WoccMCN4lv​:1␤␤»

Fixed this (and flattening positionals, and normal nameds), and added tests for them all in S05-grammar/signatures.t.

@p6rt
Copy link
Author

p6rt commented Oct 6, 2015

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

@p6rt p6rt closed this as completed Oct 6, 2015
@p6rt
Copy link
Author

p6rt commented Oct 6, 2015

@jnthn - Status changed from 'open' to 'resolved'

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

1 participant