Front page | perl.perl6.compiler |
Postings from June 2010
From: Chris Fields
June 1, 2010 02:04
Message ID: 8060F8BA-CA51-4A1A-A62A-D76EA1279AFF@illinois.edu
Funny, went to IRC after seeing this brought up to respond, and didn't even notice you made this the weekly contribution to perl6! I have a Str.trans implementation on my rakudo github fork that's working and passes 20 tests:
A few caveats:
1) It's very simplistic and just does alternation mapping using the recent regex interpolation additions. I agree we could switch to .comb if needed. Matching against a long list of alternates using captures like /<@alternates>/ is very slow (one of the tests bears this out). If these are somehow stringified and maybe regex grouped they may be faster.
2) No regex matching yet, but we do have closures working.
3) :d and :s work, but I don't think these are spec'ed.
4) Simple single char transliteration should be very efficient and could be optimized as a special case.
5) A strange bug: the following test does not parse; this broke recently. Any obvious reason why this is breaking?
is(" <>&".trans( [' ', '<', '>', '&'] =>
[' ', '<', '>', '&' ] ),
" <>&","The array version can map one characters to one-or-more characters");
I think, in order to get regexes to work we will need a way of getting the name of the matching regex from the Match object somehow. Any idea how to do that?
by Chris Fields