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

Commit

Permalink
Update ** quantifier a bit, recognize trailing spaces as request to
Browse files Browse the repository at this point in the history
add <.ws> between each element.  (This isn't completely what S05
specifies, but it's a good first cut.)
  • Loading branch information
pmichaud committed Jun 3, 2010
1 parent b338c2b commit a68924f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/Regex/P6Regex/Actions.pm
Expand Up @@ -117,8 +117,19 @@ method quantifier:sym<?>($/) {
method quantifier:sym<**>($/) {
my $past;
if $<quantified_atom> {
my $ast := $<quantified_atom>.ast;
if $<normspace> && @MODIFIERS[0]<s> {
$ast := PAST::Regex.new(
:pasttype('concat'),
PAST::Regex.new( 'ws', :pasttype('subrule'),
:subtype('method') ),
$ast,
PAST::Regex.new( 'ws', :pasttype('subrule'),
:subtype('method') )
);
}
$past := PAST::Regex.new( :pasttype('quant'), :min(1),
:sep( $<quantified_atom>.ast ), :node($/) );
:sep( $ast ), :node($/) );
}
else {
$past := PAST::Regex.new( :pasttype('quant'), :min(+$<min>), :node($/) );
Expand Down
2 changes: 1 addition & 1 deletion src/Regex/P6Regex/Grammar.pm
Expand Up @@ -54,7 +54,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar;
token quantifier:sym<+> { <sym> <backmod> }
token quantifier:sym<?> { <sym> <backmod> }
token quantifier:sym<**> {
<sym> \s* <backmod> \s*
<sym> <normspace>? <backmod> <normspace>?
[
|| $<min>=[\d+]
[ '..'
Expand Down

0 comments on commit a68924f

Please sign in to comment.