docopt / docopt.cpp

C++11 port of docopt
Boost Software License 1.0
1.04k stars 146 forks source link

replacing std::regex with ctre #141

Closed andijcr closed 1 year ago

andijcr commented 3 years ago

I replaced std::regex with https://github.com/hanickadot/compile-time-regular-expressions . In doing so I had to add a .clang-format, remove boost regex, and move the standard to c++17 (this last one is a hard requirement for ctre). Is there an interest in these changes, or is it out of scope for this project?

you can find my fork here: https://github.com/andijcr/docopt.cpp/tree/feat/ctre

nfrmtkr commented 3 years ago

I would vote for it because std::regex of Microsoft Visual C++ has mayn issues. The one you'll hit very soon is: Grouping within repetition causes regex stack error However, I would prefer a plugable regex approach allowing to add your own regex library. For instance PCRE.

jaredgrubb commented 3 years ago

I do like this idea ... does it all work ok with CTRE? Whats the compile time change?

andijcr commented 3 years ago

I opened a pull request to compare the changes. The important changes are in this commit https://github.com/andijcr/docopt.cpp/commit/ca98f8496e0728371af5b0ae8a3fb26f1d3e4892 The compile time tends to be worse than before, but it's limited only to a translation unit of the library, so it's a price paid only once when at the first build. The major problem it's the hard requirement for c++20, but since the changes are localized I think some ifdefs should be able to handle it.