Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please switch to pcre2 #25

Open
glondu opened this issue Nov 18, 2021 · 12 comments
Open

Please switch to pcre2 #25

glondu opened this issue Nov 18, 2021 · 12 comments

Comments

@glondu
Copy link

glondu commented Nov 18, 2021

PCRE (known as PCRE3 in Debian), used by pcre-ocaml, is obsolete. Pcre-ocaml should be ported to PCRE2.

@glondu
Copy link
Author

glondu commented Dec 5, 2021

FTR: PCRE2Project/pcre2#51

@mjambon
Copy link
Contributor

mjambon commented Jan 15, 2022

Philip Hazel recently added support for more Unicode character properties in PCRE2, which is useful and lacking from PCRE1.

@mmottl
Copy link
Owner

mmottl commented Jan 17, 2022

It would certainly make sense to switch to PCRE2. Unfortunately, I do not currently have time to work on this. I don't know to which extent PCRE2 is backward-compatible. I assume many parts of the resulting API would be significantly different, but most functions for e.g. splitting, replacing, etc., can probably be adapted easily.

I'd suggest forking pcre-ocaml to pcre2-ocaml and leaving pcre-ocaml as-is. Once pcre2-ocaml is sufficiently stable, pcre-ocaml could be marked as obsolete.

@tobil4sk
Copy link

Hello, I've created a fork as we needed to update the pcre bindings for the Haxe compiler. It's available here if anyone is interested: https://github.com/tobil4sk/pcre2-ocaml

I've just rewritten the existing ocaml functions to use pcre2, without adding much of the new pcre2 functionality which could be added. However, jit compilation is missing, and get_match_limit and get_match_limit_recursion (would now be get_depth_limit) also had to be removed for now since there is no easy way to implement them in pcre2, though the values could be stored manually. A few function names have also been changed to reflect the new pcre2 api, though exec remained the same as match is a reserved keyword.

I'm happy to accept PRs if anyone wants to expand the functionality, however, I unfortunately don't have the OCaml knowledge to maintain a package, so I don't plan to work on it myself any more than what is needed by Haxe. So if anyone would like to fork and properly maintain it, feel free to do so.

@Uzume
Copy link

Uzume commented Mar 25, 2023

@tobil4sk: Yes, it would be good to get this up on opam (even in its current state). Perhaps this will stimulate interest and someone will step up (it seems like Markus does not want to maintain this further). Many things still depend on pcre-ocaml and I am sure if they are maintained at all they want to get off it. I know Plato inspired the proverb "necessity is the mother of invention" but often it also begets interest.

@toots
Copy link

toots commented Jul 29, 2023

@tobil4sk This looks great. Would you consider moving the code to https://github.com/ocaml-community/ ?

@chetmurthy
Copy link

@tobil4sk If nobody else volunteers to help with maintenance and publishing to opam, I will be happy to volunteer. Camlp5's pa_ppx_regexp relies on pcre, and I certainly want pcre to be available to ocaml for the foreseeable future.

@tobil4sk
Copy link

@chetmurthy Do feel free to take it on. As I said before I'm not currently deep enough into the OCaml ecosystem to be able to properly maintain a package myself. Might be worth considering https://github.com/ocaml-community/ as @toots mentioned. If you have any questions or anything, let me know, I can try my best to answer.

It might also be good if someone with more experience than me with OCaml C bindings would have a look to make sure there aren't any glaring issues before a proper release is made. I tried to follow the guidance in the OCaml docs and the bindings work fine so far for our project (Haxe) but C code is always prone to random memory issues and the like.

@chetmurthy
Copy link

@tobil4sk OK, before I do so, I thought I'd ask on the OCaml discussion forum if anybody wanted to take it on? Just b/c .... well, I feel a little odd picking up something that's this .... useful. I maintain a bunch of stuff that's pretty peripheral, and .... pcre is anything but peripheral (to me).

Re: OCaml/C bindings, I've had a lot of experience with that, and will do a (trying to be) careful scan before I release, if I take this up.

Can you let me know if it's OK for mme to post on the OCaml forum, asking if anybody else wants to take this project up?

@glondu
Copy link
Author

glondu commented Aug 18, 2023

Can you let me know if it's OK for mme to post on the OCaml forum, asking if anybody else wants to take this project up?

@chetmurthy Please proceed.

@tobil4sk
Copy link

Can you let me know if it's OK for mme to post on the OCaml forum, asking if anybody else wants to take this project up?

@chetmurthy That's all good with me, thanks.

@mmottl
Copy link
Owner

mmottl commented Aug 18, 2023

Just checking in after a long hiatus. For the while being, I will maintain pcre-ocaml to make sure it still compiles and works with recent compiler releases. But future work should preferably go into new bindings for more recent PCRE versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants