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

Commit

Permalink
Refactor p6regex's handling of argument lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Nov 2, 2009
1 parent 81afeca commit c65b0dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/Regex/P6Regex/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ method arg($/) {
make $<quote> ?? ~$<quote><val> !! +$<val>;
}
method arglist($/) {
my $past := PAST::Op.new( :pasttype('list') );
for $<arg> { $past.push( $_.ast ); }
make $past;
}

method TOP($/) {
my $past := buildsub( $<nibbler>.ast );
$past.node($/);
Expand Down Expand Up @@ -374,9 +380,7 @@ method assertion:sym<name>($/) {
$past.push( buildsub($<nibbler>[0].ast) );
}
elsif $<arglist> {
for $<arglist>[0]<arg> {
$past.push( $_.ast );
}
for $<arglist>[0].ast.list { $past.push( $_ ); }
}
}
make $past;
Expand Down
2 changes: 1 addition & 1 deletion src/Regex/P6Regex/Grammar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar;
]
}

rule arglist { <arg> [ ',' <arg> ]* }
rule arglist { <arg> [ ',' <arg>]* }

token TOP {
<nibbler>
Expand Down

0 comments on commit c65b0dd

Please sign in to comment.