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

Commit

Permalink
put AST generation for named assertions into a separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Jul 7, 2010
1 parent 2fb1606 commit 70f4eb7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Regex/P6Regex/Actions.pm
Expand Up @@ -407,14 +407,7 @@ method assertion:sym<name>($/) {
);
}
else {
$past := PAST::Regex.new( $name, :name($name),
:pasttype('subrule'), :subtype('capture'), :node($/) );
if $<nibbler> {
$past.push( buildsub($<nibbler>[0].ast) );
}
elsif $<arglist> {
for $<arglist>[0].ast.list { $past.push( $_ ); }
}
$past := self.named_assertion($/);
}
make $past;
}
Expand Down Expand Up @@ -586,3 +579,16 @@ method subrule_alias($past, $name) {
else { $past.name($name); }
$past.subtype('capture');
}

method named_assertion($/) {
my $name := ~$<longname>;
my $past := PAST::Regex.new( $name, :name($name),
:pasttype('subrule'), :subtype('capture'), :node($/) );
if $<nibbler> {
$past.push( buildsub($<nibbler>[0].ast) );
}
elsif $<arglist> {
for $<arglist>[0].ast.list { $past.push( $_ ); }
}
$past;
}

0 comments on commit 70f4eb7

Please sign in to comment.