what does it take to add a new regex engine to upstream ripgrep? #2300
-
Hello, I wrote and am about to launch Kleenexp, a (Rust) compiler from a nice pleasant syntax to regular expressions, with some desirable features like needing a lot less escaping (and no double escaping), macros, number ranges (e.g. Though I assume the project won't be considered mature enough right now, in the long term I'd like submit a PR to For example an answer might involve:
Thanks a lot, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I don't think it's out of scope, but yeah I think the answer here is "just no." Scope is maybe part of that, but there's actually a whole host of reasons:
My suspicion is that PCRE2 is and will always be the only other regex engine supported by ripgrep upstream. Note that it is possible to maintain a fork of ripgrep with an additional regex engine inside of it. Someone does that for Hyperscan for example: https://sr.ht/~pierrenn/ripgrep/ ... Hopefully, the actual patch to ripgrep is itself small, and most of the changes are just in new code. With that said, it looks like Kleenexp works by compiling down to Rust regex syntax. So I imagine you might actually just be able to write a wrapper script that translates your Kleenexp to a Rust regex and then invoke ripgrep. It'd be fair of work to make it right in all cases, but I bet you could have something simple working without much effort. Otherwise, yeah, I think the best route would be a patch to ripgrep that you maintain. |
Beta Was this translation helpful? Give feedback.
I don't think it's out of scope, but yeah I think the answer here is "just no." Scope is maybe part of that, but there's actually a whole host of reasons: