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

Rakudo doesn't recognize grammars with :: in the name #389

Closed
p6rt opened this issue Nov 5, 2008 · 7 comments
Closed

Rakudo doesn't recognize grammars with :: in the name #389

p6rt opened this issue Nov 5, 2008 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Nov 5, 2008

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

Searchable as RT60358$

@p6rt
Copy link
Author

p6rt commented Nov 5, 2008

From @masak

<masak> rakudo​: grammar A { token foo { foo } }; say "foo" ~~ A​::foo
<p6eval> rakudo 32364​: OUTPUT[foo␤]
<masak> rakudo​: grammar A​::B { token foo { foo } }; say "foo" ~~ A​::B​::foo
<p6eval> rakudo 32364​: OUTPUT[0␤]

@p6rt
Copy link
Author

p6rt commented Nov 6, 2008

From @chrisdolan

On Wed Nov 05 13​:43​:54 2008, masak wrote​:

<masak> rakudo​: grammar A { token foo { foo } }; say "foo" ~~ A​::foo
<p6eval> rakudo 32364​: OUTPUT[foo␤]
<masak> rakudo​: grammar A​::B { token foo { foo } }; say "foo" ~~ A​::B​::foo
<p6eval> rakudo 32364​: OUTPUT[0␤]

The problem is more evident in PIR. The grammar reduces to something
like this​:

  .namespace ["PDF​::Grammar"]
  .sub "literal_string" :method

instead of this​:

  .namespace ["PDF";"Grammar"]
  .sub "literal_string" :method

I think the fault is in languages/perl6/src/parser/actions.pm

  method regex_declarator_rule($/) {
  ...
  $past.name( ~$&lt;identifier>[0] );

(as well as regex_declarator_regex and regex_declarator_token). If
these took <name> instead of <identifier>, just like <package_def> does,
then maybe that would help, but I'm not sure.

@p6rt
Copy link
Author

p6rt commented Nov 6, 2008

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

@p6rt
Copy link
Author

p6rt commented Nov 6, 2008

From @chrisdolan

It took a while to understand the code, but the solution was a
one-liner. Patch attached.

@p6rt
Copy link
Author

p6rt commented Nov 6, 2008

From @chrisdolan

RT#60358.patch
Index: src/parser/actions.pm
===================================================================
--- src/parser/actions.pm	(revision 32369)
+++ src/parser/actions.pm	(working copy)
@@ -2544,7 +2544,7 @@
         $past := PAST::Block.new(
             $<quote_regex>,
             :compiler('PGE::Perl6Regex'),
-            :namespace($?NS),
+            :namespace(Perl6::Compiler.parse_name( $?NS )),
             :blocktype('declaration'),
             :node( $/ )
         );

@p6rt
Copy link
Author

p6rt commented Nov 11, 2008

From @jnthn

On Wed Nov 05 19​:31​:36 2008, chrisdolan wrote​:

It took a while to understand the code, but the solution was a
one-liner. Patch attached.
Unfortunately, the patch produced a bunch of spectest failures. However,
it wasn't because the patch was wrong, but rather a bug in some code
generation in PCT. I fixed that, and then the patch worked and did the
Right Thing, so it's applied in r32546. Plus got us spectesting this.

Thanks!

Jonathan

@p6rt
Copy link
Author

p6rt commented Nov 11, 2008

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

@p6rt p6rt closed this as completed Nov 11, 2008
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