Code Comments
Programming Forum and web based access to our favorite programming groups.On Thu, Apr 17, 2008 at 10:20 PM, Jonathan Worthington via RT
<perl6-bugs-followup@perl.org> wrote:
>
> St=E9phane Payrard wrote:
> 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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D
--- languages/perl6/src/parser/actions.pm=09(revision 27021)
+++ languages/perl6/src/parser/actions.pm=09(working copy)
@@ -796,11 +796,11 @@
if $key eq 'open' {
# Start of the block; if it's a class or role, need to make $?CLAS=
S 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 :=3D 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'),
--=20
cognominal stef
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.