Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #573 from ungrim97/feature/non_inc_range_quantifier
Add support for 1^..^10 non inclusive range quantifiers in regexs
  • Loading branch information
timo committed Nov 5, 2015
2 parents 183d699 + c698e20 commit 55d55f3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Perl6/Actions.nqp
Expand Up @@ -8543,11 +8543,22 @@ class Perl6::RegexActions is QRegex::P6Regex::Actions does STDActions {
);
}
else {
my $min := $<min>.ast;
my $min := 0;
if $<min> { $min := $<min>.ast; }

my $max := -1;
if ! $<max> { $max := $min }
my $upto := $<upto>;

if $<from> eq '^' { $min++ }

if ! $<max> {
$max := $min
}
elsif $<max> ne '*' {
$max := $<max>.ast;
if $<upto> eq '^' {
$max--;
}
$/.CURSOR.panic("Empty range") if $min > $max;
}
$qast := QAST::Regex.new( :rxtype<quant>, :min($min), :max($max), :node($/) );
Expand Down

0 comments on commit 55d55f3

Please sign in to comment.