# New Ticket Created by Chris Fields # Please include the string: [perl #59446] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59446 >
Attached is a patch which implements preliminary support for Regexes
and Closures and hews much closer to S05's definition of
transliteration:
1) allowing Hashes/Lists as arguments, and
2) spaces are important in Ranges: 'A .. Z' is interpreted as a list
of ('A', ' ', 'Z'), not ('A'..'Z')
A few unspec'd portions are the modifiers and their long names:
behavior of :c (:complement), :d (:delete), and :s (:squash) hasn't
been covered in S05 yet, but the behavior is similar to what is found
for p5 tr///. These can be updated fairly easily when this is covered
in more detail. Also, a few spots in the patch will require future
updating once Regex becomes a valid class and once HLL mapping is
complete:
1) 'String' is type-checked for one private multisub, '!transtable';
it should be 'Perl6Str'. but this fails under some conditions
2) Regex isn't implemented as a type yet (it shows up as 'Block' or
'Sub'); I am type-checking it against 'Sub' for now
One unresolved issue: acc. to S05, in cases where the match is a Regex
and the replacement is a Closure, the Match object is passed to the
Closure. This currently fails in Rakudo but I left this in the patch
for bug testing. The issue appears similar to RT 58352. I'll look
this issue up in RT and if needed I'll file as a separate bug; the
following demonstrates the bug with the current patch applied:
say "ABC123DEF456GHI".trans(
[/ <alpha>+ /, 'B', 'C'] => [{ 'foo' } ,'b' , 'c']
);
say "ABC123DEF456GHI".trans(
[/ <alpha>+ /, 'B', 'C'] => [{ chr($0) } ,'b' , 'c']
);
Error: Null PMC access in get_pmc_keyed_int()
chris
trans.diff
Description: Binary data
