chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH][5] Problem with utf8 character classes in irre


From: lemonboy
Subject: [Chicken-hackers] [PATCH][5] Problem with utf8 character classes in irregex
Date: Thu, 9 Nov 2017 13:38:02 +0100
User-agent: NeoMutt/20170113 (1.7.2)

Hello hackers,
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 "[一二]" "三四")    <--
>  #;14> 

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
reached.

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.

Cheers,
LemonBoy

Attachment: 0001-Fix-an-error-in-unicode-range-utf8-pattern.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]