[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Problem with utf8 character classes in irre
[Chicken-hackers] [PATCH] Problem with utf8 character classes in irregex
Thu, 9 Nov 2017 13:38:02 +0100
here's a patch for the bug reported by Chunyang Xu on CHICKEN-users, I'm
reporting a piece of their mail below:
> #;1> (use utf8)
> ; loading /usr/local/Cellar/chicken/4.12.0/lib/chicken/8/utf8.import.so ...
> ; loading /usr/local/Cellar/chicken/4.12.0/lib/chicken/8/utf8.so ...
> #;5> (string-match "[一二]" "三四")
> Error: (sre-length-ranges) unknown sre: ()
> Call history:
> <syntax> (string-match "[一二]" "三四")
> <eval> (string-match "[一二]" "三四") <--
The fix is really simple but a bit hairy IMO, feel free to refactor the code,
and simply avoids the tailing '() by stopping before the end of the list is
Another approach that results in a slightly longer patch is to generate a single
`sre-sequence' with a tail-recursive loop, if you prefer this kind of fix you
just have to ask :)
Oh, the patch is made against the chicken-5 branch, backporting it to master
should be straightforward.
Description: Text Data
- [Chicken-hackers] [PATCH] Problem with utf8 character classes in irregex,