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

Commit

Permalink
Browse files Browse the repository at this point in the history
More updates to P6Grammar bootstrapping.
P6Grammar is now able to parse and produce a partial past tree
for its own grammar definition (in src/Regex/P6Grammar/Grammar.pm).
Still need a metachar:<{*}> action method to produce action methods.  :-)
  • Loading branch information
pmichaud committed Oct 15, 2009
1 parent bbbca64 commit 2b0f1ad
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/PARROT_REVISION
@@ -1 +1 @@
41749
41871
16 changes: 15 additions & 1 deletion src/Regex/P6Grammar/Actions.pm
@@ -1,3 +1,17 @@
class Regex::P6Grammar::Actions;
class Regex::P6Grammar::Actions is Regex::P6Regex::Actions;

method TOP($/) {
my $past := PAST::Stmts.new();
for $<regex_stmt> {
$past.push( $_.ast );
}
make $past;
}


method regex_stmt($/) {
my $rpast := $<nibbler>.ast;
my $past := PAST::Block.new( $rpast, :name(~$<longname>),
:blocktype('method') );
make $past;
}
4 changes: 4 additions & 0 deletions src/Regex/P6Regex/Actions.pm
Expand Up @@ -173,6 +173,10 @@ method metachar:sym<rwb>($/) {
make $past;
}

method metachar:sym<{*}>($/) {
make 0;
}

method metachar:sym<bs>($/) {
make $<backslash>.ast;
}
Expand Down

0 comments on commit 2b0f1ad

Please sign in to comment.