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
Add :sigspace handling to range quantifiers (e.g., <x> ** 0..3)
  • Loading branch information
pmichaud committed Jun 3, 2010
1 parent 9e955a4 commit 38fc6e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Regex/P6Regex/Actions.pm
Expand Up @@ -116,9 +116,10 @@ method quantifier:sym<?>($/) {

method quantifier:sym<**>($/) {
my $past;
my $ws := $<normspace> && @MODIFIERS[0]<s>;
if $<quantified_atom> {
my $ast := $<quantified_atom>.ast;
if $<normspace> && @MODIFIERS[0]<s> {
if $ws {
$ast := PAST::Regex.new(
:pasttype('concat'),
PAST::Regex.new( 'ws', :pasttype('subrule'),
Expand All @@ -135,6 +136,9 @@ method quantifier:sym<**>($/) {
$past := PAST::Regex.new( :pasttype('quant'), :min(+$<min>), :node($/) );
if ! $<max> { $past.max(+$<min>); }
elsif $<max>[0] ne '*' { $past.max(+$<max>[0]); }
if $ws { $past.sep( PAST::Regex.new( 'ws', :pasttype('subrule'),
:subtype('method') ) );
}
}
make backmod($past, $<backmod>);
}
Expand Down

0 comments on commit 38fc6e9

Please sign in to comment.