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

Commit

Permalink
Refactor named assertions slightly for better argument handling later.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 15, 2009
1 parent 3b052a5 commit bbbca64
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Regex/P6Regex/Actions.pm
Expand Up @@ -292,18 +292,16 @@ method assertion:sym<method>($/) {
method assertion:sym<name>($/) {
my $name := ~$<longname>;
my $past;
if $<nibbler> {
my $subpast := buildsub($<nibbler>[0].ast);
$past := PAST::Regex.new( $name, $subpast, :name($name),
:pasttype('subrule'), :subtype('capture') );
}
elsif $<assertion> {
if $<assertion> {
$past := $<assertion>[0].ast;
$past.name($name);
}
else {
$past := PAST::Regex.new( $name, :name($name) , :pasttype('subrule'),
:subtype('capture') );
$past := PAST::Regex.new( $name, :name($name),
:pasttype('subrule'), :subtype('capture') );
if $<nibbler> {
$past.push( buildsub($<nibbler>[0].ast) );
}
}
make $past;
}
Expand Down

0 comments on commit bbbca64

Please sign in to comment.