Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
[p6grammar]: Add ability to declare a parent grammar.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 15, 2009
1 parent fb80e2d commit 8cd492a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Regex/P6Grammar/Actions.pm
Expand Up @@ -12,12 +12,13 @@ method TOP($/) {
method grammar_stmt($/) {
my @ns := Regex::P6Grammar::Compiler.parse_name( ~$<name> );
my $past := PAST::Block.new( :namespace(@ns) );
my $parent := $<base> ?? ~$<base>[0] !! 'Regex::Cursor';
my $init :=
PAST::Op.new(
PAST::Var.new( :name('P6metaclass'), :scope('package'),
:namespace('') ),
~$<name>,
PAST::Val.new( :value('Regex::Cursor'), :named('parent') ),
PAST::Val.new( :value($parent), :named('parent') ),
:pasttype('callmethod'), :name('new_class')
);
$past.loadinit($init);
Expand Down

0 comments on commit 8cd492a

Please sign in to comment.