Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
canonicalize regex adverb names
This makes  ~~ m:ignorecase/.../ work again; the long forms already
worked on the inside of regexes.
  • Loading branch information
moritz committed Feb 13, 2012
1 parent 125e7f9 commit f3fe530
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Perl6/Actions.pm
Expand Up @@ -3807,13 +3807,26 @@ class Perl6::Actions is HLL::Actions {
our %SUBST_ALLOWED_ADVERBS ;
our %SHARED_ALLOWED_ADVERBS;
our %MATCH_ALLOWED_ADVERBS;
our %MATCH_ADVERBS_MULTIPLE := hash(
our %MATCH_ADVERBS_MULTIPLE := hash(
x => 1,
g => 1,
global => 1,
ov => 1,
overlap => 1,
);
our %REGEX_ADVERBS_CANONICAL := hash(
ignorecase => 'i',
ratchet => 'r',
sigspace => 's',
continue => 'c',
pos => 'p',
th => 'nth',
st => 'nth',
nd => 'nth',
rd => 'nth',
global => 'g',
overlap => 'ov',
);
INIT {
my $mods := 'i ignorecase s sigspace r ratchet';
for nqp::split(' ', $mods) {
Expand Down Expand Up @@ -3877,6 +3890,7 @@ class Perl6::Actions is HLL::Actions {
$*W.throw($/, ['X', 'Value', 'Dynamic'], what => "Adverb $key");
}
}
$key := %REGEX_ADVERBS_CANONICAL{$key} // $key;
%*RX{$key} := $value;
}

Expand Down

0 comments on commit f3fe530

Please sign in to comment.