Skip to content

Commit

Permalink
wire up tr/// to .trans
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Sep 1, 2013
1 parent 53d1083 commit 152a539
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -5419,6 +5419,18 @@ class Perl6::Actions is HLL::Actions does STDActions {
$multiple;
}

method quote:sym<tr>($/) {
my $left := ~$<tribble><left>;
my $right := ~$<tribble><right>;
make QAST::Op.new(:op<p6store>,
QAST::Var.new(:name('$_'), :scope<lexical>),
QAST::Op.new(:op<callmethod>, :name<trans>,
QAST::Var.new(:name('$_'), :scope<lexical>),
make_pair($left, QAST::SVal.new(:value($right))),
)
);
}

method quote:sym<s>($/) {
# Build the regex.
my $rx_block := QAST::Block.new(QAST::Stmts.new, QAST::Stmts.new, :node($/));
Expand Down
6 changes: 1 addition & 5 deletions src/Perl6/Grammar.nqp
Expand Up @@ -2961,15 +2961,11 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}

token quote:sym<tr> {
<sym> (s)**0..1 >>
<sym>
:my %*RX;
{
%*RX<tr> := 1 if $/[0]
}
<rx_adverbs>
<tribble(%*RX<P5> ?? %*LANG<P5Regex> !! %*LANG<Regex>, %*LANG<Q>, ['cc'])>
<.old_rx_mods>?
<.NYI('tr///')>
}

token old_rx_mods {
Expand Down

0 comments on commit 152a539

Please sign in to comment.