On Thu, Apr 17, 2008 at 10:20 PM, Jonathan Worthington via RT <[EMAIL PROTECTED]> wrote: > > Stéphane Payrard wrote: > > running the code with --target=pir, I see that the 'token a' regex > > is generated as a method with an empty namespace. > > > As far as I'm aware, the grammar keyword isn't properly implemented yet > (it'll parse, but that's probably about it). > > Jonathan > > >
There is not much missing. The following patch already gets .WHAT to work. The code for grammar methods is apparently correctly generated except for the namespace. grammar A { token aa { baba } }; say A.WHAT; Index: languages/perl6/src/parser/actions.pm =================================================================== --- languages/perl6/src/parser/actions.pm (revision 27021) +++ languages/perl6/src/parser/actions.pm (working copy) @@ -796,11 +796,11 @@ if $key eq 'open' { # Start of the block; if it's a class or role, need to make $?CLASS or # $?ROLE available for storing current definition in. - if $<sym> eq 'class' || $<sym> eq 'role' { + if $<sym> eq 'class' || $<sym> eq 'role' || $<sym> eq 'grammar' { my $decl_past := PAST::Stmts.new(); # If it's a class... - if $<sym> eq 'class' { + if $<sym> eq 'class' || $<sym> eq 'grammar' { # Call method to create the class. $decl_past.push(PAST::Op.new( :pasttype('bind'), @@ -914,7 +914,7 @@ $past.blocktype('declaration'); $past.pirflags(':init :load'); - if $<sym> eq 'class' { + if $<sym> eq 'class' || $<sym> eq 'grammar' { # Make proto-object. $?CLASS.push(PAST::Op.new( :pasttype('call'), -- cognominal stef