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

Commit

Permalink
Add regex parameters to named assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 14, 2009
1 parent b9ea370 commit 3af996e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Regex/P6Regex/Actions.pm
Expand Up @@ -277,7 +277,12 @@ method assertion:sym<method>($/) {
method assertion:sym<name>($/) {
my $name := ~$<longname>;
my $past;
if $<assertion> {
if $<nibbler> {
my $subpast := buildsub($<nibbler>[0].ast);
$past := PAST::Regex.new( $name, $subpast, :name($name),
:pasttype('subrule'), :subtype('capture') );
}
elsif $<assertion> {
$past := $<assertion>[0].ast;
$past.name($name);
}
Expand Down
1 change: 1 addition & 0 deletions src/Regex/P6Regex/Grammar.pm
Expand Up @@ -113,6 +113,7 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;
$<longname>=[\w+]
[
| <?before '>'>
| <.normspace> <nibbler>
| '=' <assertion>
]?
{*}
Expand Down

0 comments on commit 3af996e

Please sign in to comment.