Permalink
Browse files

wire up tr/// to .trans

  • Loading branch information...
1 parent 53d1083 commit 152a5398f9358b1b49ecb21dfa34322a180bdfe9 @moritz moritz committed Sep 1, 2013
Showing with 13 additions and 5 deletions.
  1. +12 −0 src/Perl6/Actions.nqp
  2. +1 −5 src/Perl6/Grammar.nqp
View
12 src/Perl6/Actions.nqp
@@ -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($/));
View
6 src/Perl6/Grammar.nqp
@@ -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 {

0 comments on commit 152a539

Please sign in to comment.