Fix pushed.

On Fri, Dec 27, 2019 at 4:51 PM Duy Nguyen <xxxxxx@gmail.com> wrote:
On Thu, Dec 26, 2019 at 11:10 PM Alex Shinn <xxxxxx@gmail.com> wrote:
>
> On Tue, Dec 3, 2019 at 7:24 AM Chris Hanson <xxxxxx@chris-hanson.org> wrote:
>>
>> The definition of regexp-replace specifies the meanings of ‘pre and ‘post as substitution arguments.
>>
>> What I expect is that ‘pre/‘post will transform into
>>
>> (substring string start (regexp-match-submatch-start match 0))
>> (substring string (regexp-match-submatch-end match 0) end)
>>
>> However, looking at the chibi implementation (the only one I’ve found after 10 minutes of searching), what these transform into is
>
>
> Were you hoping to find others or did you have trouble finding the reference implementation?  It is linked from the SRFI document.
>
> A complete regexp engine is quite a bit of work so it's unsurprising if there are no other impls, though borrowing sre->pcre and wrapping another impl is reasonable.

For what it's worth, Gauche also supports this srfi (except grapheme
stuff) but it's in the second category, converting sre to gauche ast
syntax, not full regexp engine written in Scheme.

>> (substring string 0 (regexp-match-submatch-start match 0))
>> (substring string (regexp-match-submatch-end match 0) (string-length string))
>>
>> I suspect that this is a bug, given this sentence in the description:
>>
>> The optional parameters start and end restrict both the matching and the substitution, to the given indices, such that the result is equivalent to omitting these parameters and replacing on (substring str start end).
>>
>>
>> But I’d appreciate confirmation of this. It might also be good to clarify what happens here.
>
>
> Yes, thanks for catching this, 'pre/'post should respect start and end.  I will fix this.

Thanks. Gauche sre behaves this way, so I don't have to fix anything else :D
--
Duy