Skip to content

Commit

Permalink
Properly numify non-ascii tokens in regex/grammars
Browse files Browse the repository at this point in the history
Fix RT #127075
  • Loading branch information
MasterDuke17 committed Sep 10, 2016
1 parent 32fd43d commit 71b434f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/QRegex/P6Regex/Actions.nqp
Expand Up @@ -887,14 +887,26 @@ class QRegex::P6Regex::Actions is HLL::Actions {
if $name eq '' { $name := $count; $ast.name($name); }
my @names := nqp::split('=', $name);
for @names {
if $_ eq '0' || $_ > 0 { $count := $_ + 1; }
%capnames{$_} := 1;
my $n := nqp::radix(10, $_, 0, 0)[0];
if $_ eq '0' || $n > 0 {
$count := $n + 1;
%capnames{$n} := 1
}
else {
%capnames{$_} := 1;
}
}
}
elsif $rxtype eq 'subcapture' {
for nqp::split(' ', $ast.name) {
if $_ eq '0' || $_ > 0 { $count := $_ + 1; }
%capnames{$_} := 1;
my $n := nqp::radix(10, $_, 0, 0)[0];
if $_ eq '0' || $n > 0 {
$count := $n + 1;
%capnames{$n} := 1
}
else {
%capnames{$_} := 1;
}
}
my %x := capnames($ast[0], $count);
for %x { %capnames{$_.key} := +%capnames{$_.key} + %x{$_.key} }
Expand Down

0 comments on commit 71b434f

Please sign in to comment.