DGM#denormalize - Mac style line breaks and empty string
I would like normalize to be string-based and to not change whether there is a final line ending.
Patch for the trunk to make normalize and denormalize be string-based and which tighter semantics. Test cases updated.
Committed to trunk (cs15032). If there is no objection then I'll push this into the other branches.
The results seem to be fine now
However the implementation is quite slow now. In my tests normalize is up to factor 25 slower than a character based single-pass implementation (patch from http://jira.codehaus.org/browse/GROOVY-3264). RegExes are expensive.
Yeah, I was afraid of that. But if we now agree on this API, speed tuning would be worthwhile.
If you want to update your patch, that would be dandy.
It would also be nice to know how much difference precompiling the patterns makes.
Attached alternative implementations and a patch for the 1_6_X branch.
I've committed (trunk first - cs15089 - branches later) tuned up versions of normalize and denormalize. I've used somewhat different logic and there are a couple comments explaining that.
Also I didn't use the tests because there already are some in groovy.StringTest.groovy. If there are any cases missing from there, please do add them there.
Thanks for your help!