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

Grammar.parse does not ignore unknown named args #4775

Closed
p6rt opened this issue Nov 22, 2015 · 5 comments
Closed

Grammar.parse does not ignore unknown named args #4775

p6rt opened this issue Nov 22, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Nov 22, 2015

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

Searchable as RT126708$

@p6rt
Copy link
Author

p6rt commented Nov 22, 2015

From @skids

This is a regression since star09 which make Grammar more tedious to subclass.

(01​:52​:42 PM) skids​: m​: grammar foo { rule TOP { . } }; foo.parse("foo",​:subclass_arg_to_ignore)
(01​:53​:02 PM) camelia​: rakudo-moar : OUTPUT«Unexpected named parameter 'subclass_arg_to_ignore' passed␤ in block <unit> at /tmp/cUwyy7Hppz​:1␤␤»
(01​:53​:12 PM) skids​: star​: grammar foo { rule TOP { . } }; foo.parse("foo",​:subclass_arg_to_ignore)
(01​:53​:12 PM) camelia​: star-m 2015.09​: ( no output )
(01​:53​:34 PM) skids​: That was breaking Grammar​::BNF but I worked around it.

@p6rt
Copy link
Author

p6rt commented Nov 22, 2015

From @skids

On Sun Nov 22 10​:58​:57 2015, bri@​abrij.org wrote​:

This is a regression since star09 which make Grammar more tedious to
subclass.

(01​:52​:42 PM) skids​: m​: grammar foo { rule TOP { . } };
foo.parse("foo",​:subclass_arg_to_ignore)
(01​:53​:02 PM) camelia​: rakudo-moar : OUTPUT«Unexpected named parameter
'subclass_arg_to_ignore' passed␤ in block <unit> at
/tmp/cUwyy7Hppz​:1␤␤»
(01​:53​:12 PM) skids​: star​: grammar foo { rule TOP { . } };
foo.parse("foo",​:subclass_arg_to_ignore)
(01​:53​:12 PM) camelia​: star-m 2015.09​: ( no output )
(01​:53​:34 PM) skids​: That was breaking Grammar​::BNF but I worked
around it.

Followup IRC conversation

(02​:00​:09 PM) psch​: m​: say f(*%opts) { say %opts.perl }; f :subclass_arg_to_ignore
(02​:00​:10 PM) camelia​: rakudo-moar : OUTPUT«===SORRY!=== Error while compiling /tmp/ZrVtxYeq93␤Unexpected block in infix position (missing statement control word before the expression?)␤at /tmp/ZrVtxYeq93​:1␤------> say f(*%opts)⏏ { say %opts.perl }; f :subclass_arg_to_␤ expecting…»
(02​:00​:16 PM) psch​: m​: sub f(*%opts) { say %opts.perl }; f :subclass_arg_to_ignore
(02​:00​:17 PM) camelia​: rakudo-moar : OUTPUT«{​:subclass_arg_to_ignore}␤»
(02​:00​:46 PM) psch​: m​: class A { method m(*%opts) { say %opts.perl } }; A.new.m :subclass_arg_to_ignore
(02​:00​:46 PM) camelia​: rakudo-moar : OUTPUT«{​:subclass_arg_to_ignore}␤»
(02​:00​:54 PM) psch​: m​: say Grammar.^can('parse')>>.candidates>>.signature
(02​:00​:54 PM) camelia​: rakudo-moar : OUTPUT«(((Grammar $​: $target, :$rule = { ... }, :$args = { ... }, Mu :$actions = { ... }, *%opt)))␤»
(02​:01​:10 PM) skids​: Maybe it is actually the call to the .cursor method complaining.
(02​:03​:52 PM) timotimo​: if it's a call to a method, a named parameter wouldn't complain without some extra code to do the complaining
(02​:04​:11 PM) UKcodeFan [56a70edc@​gateway/web/freenode/ip.86.167.14.220] entered the room.
(02​:04​:28 PM) skids​: Do nqp methods follow that convention as well?
(02​:04​:55 PM) timotimo​: i believe so, yeah
(02​:05​:05 PM) timotimo​: if you really do mean methods and not nqp​:: things
(02​:06​:37 PM) skids​: Well if it has to be caled as self."!cursor_init" who knows how it was cobbled together.
(02​:06​:59 PM) raiph​: m​: my $*foo = 1; say :$*foo # searched rakudo src and clogs for "unexpected named parameter"; I think this one's coming from `say`
(02​:07​:00 PM) camelia​: rakudo-moar : OUTPUT«Unexpected named parameter 'foo' passed␤ in block <unit> at /tmp/t_aKAYrx6z​:1␤␤»
(02​:08​:08 PM) psch​: nqp-m​: class A { method foo() { } }; A.new.foo :bar
(02​:08​:08 PM) camelia​: nqp-moarvm​: OUTPUT«Confused at line 2, near "A.new.foo "␤ at gen/moar/stage2/NQPHLL.nqp​:521 (/home/camelia/rakudo-m-inst-1/share/nqp/lib/NQPHLL.moarvm​:panic​:105)␤ from gen/moar/stage2/NQP.nqp​:921 (/home/camelia/rakudo-m-inst-1/share/nqp/lib/nqp.moarvm​:comp_unit​:872)␤ from …»
(02​:08​:14 PM) psch​: nqp-m​: class A { method foo() { } }; A.new.foo(​:bar)
(02​:08​:15 PM) camelia​: nqp-moarvm​: OUTPUT«Unexpected named parameter 'bar' passed␤ at /tmp/K857Ys5RPJ​:1 (<ephemeral file>​:foo​:3)␤ from /tmp/K857Ys5RPJ​:1 (<ephemeral file>​:<mainline>​:37)␤ from gen/moar/stage2/NQPHLL.nqp​:1303 (/home/camelia/rakudo-m-inst-1/share/nqp/lib/NQPHLL.moarvm​:eval​:190)␤…»
(02​:09​:21 PM) psch​: no interface consistency in nqp it seems

@p6rt
Copy link
Author

p6rt commented Dec 12, 2015

From @jnthn

On Sun Nov 22 10​:58​:57 2015, bri@​abrij.org wrote​:

This is a regression since star09 which make Grammar more tedious to
subclass.

(01​:52​:42 PM) skids​: m​: grammar foo { rule TOP { . } };
foo.parse("foo",​:subclass_arg_to_ignore)
(01​:53​:02 PM) camelia​: rakudo-moar : OUTPUT«Unexpected named parameter
'subclass_arg_to_ignore' passed␤ in block <unit> at
/tmp/cUwyy7Hppz​:1␤␤»
(01​:53​:12 PM) skids​: star​: grammar foo { rule TOP { . } };
foo.parse("foo",​:subclass_arg_to_ignore)
(01​:53​:12 PM) camelia​: star-m 2015.09​: ( no output )
(01​:53​:34 PM) skids​: That was breaking Grammar​::BNF but I worked
around it.

Fixed, and test coverage added to S12-class/interface-consistency.t.

@p6rt
Copy link
Author

p6rt commented Dec 12, 2015

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

@p6rt p6rt closed this as completed Dec 12, 2015
@p6rt
Copy link
Author

p6rt commented Dec 12, 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