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

cannot pass rule param to Grammar.parse method using => syntax #2016

Closed
p6rt opened this issue Aug 5, 2010 · 5 comments
Closed

cannot pass rule param to Grammar.parse method using => syntax #2016

p6rt opened this issue Aug 5, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Aug 5, 2010

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

Searchable as RT77006$

@p6rt
Copy link
Author

p6rt commented Aug 5, 2010

From @bbkr

This works fine​:

[17​:05] <bbkr> rakudo​: grammar A {token t { ^\d\d$ }; }; say "OK" if
A.parse("22", :rule<t>);
[17​:05] <p6eval> rakudo 708347​: OUTPUT«OKâ�¤Â»

But this fails​:
[17​:05] <bbkr> rakudo​: grammar A {token t { ^\d\d$ }; }; say "OK" if
A.parse("22", rule => 't');
[17​:05] <p6eval> rakudo 708347​: OUTPUT«===SORRY!===â�¤Malformed regex at line
22, near "=> 't');"�»

[17​:05] <bbkr> hmm, why the second case do not work? bug?
[17​:06] <moritz_> parsing bug, probably
[17​:06] <moritz_> it commits to parse it as a rule declarator

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 31, 2011

From @bbkr

Both cases work on Orlando release​:

[18​:03] <bbkr_> rakudo​: grammar A {token t { ^\d\d$ }; }; say "OK" if
A.parse("22", :rule<t>);
[18​:03] <p6eval> rakudo 4bf132​: OUTPUT«OKâ�¤Â»
[18​:03] <bbkr_> rakudo​: grammar A {token t { ^\d\d$ }; }; say "OK" if
A.parse("22", rule => 't');
[18​:04] <p6eval> rakudo 4bf132​: OUTPUT«OKâ�¤Â»

@p6rt
Copy link
Author

p6rt commented Jun 5, 2012

From @moritz

FWIW this has nothing to do with Grammar.parse and everything to do with
parsing pairs with "keywords" as keys.

Tested in S02-names-vars/names.t.

@p6rt
Copy link
Author

p6rt commented Jun 5, 2012

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

@p6rt p6rt closed this as completed Jun 5, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant