Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.13k stars 93 forks source link

Update path2regex. #168

Closed Lord-Kamina closed 1 year ago

Lord-Kamina commented 1 year ago

Updated the path2regex code to be in line with the latest version of the javascript code, this version does not rely on std::cregex_iterator to create the matching pattern., and thus solves #166

I haven't tested it too extensively, but I did test it with some of the examples from the wiki, as well as in the context of performous, and it appears to be working as expected.

Of note: This version does not allow modifiers outside a capturing group, so for example to match anything the route would be "(.*)" instead of ".*"

eao197 commented 1 year ago

Thanks, @Lord-Kamina

I'll try to take look at it a the beginning of the next week.

cc @ngrodzitski

eao197 commented 1 year ago

Sorry, I can't accept this PR because I can't compile it.

https://github.com/performous/restinio/blob/deeaf083d95cb80a1746048d4f9851050cb95b65/dev/restinio/path2regex/path2regex.hpp#L611-L618 There are no data members value and index in lextoken_t struct (but they are initialized in constructors).

https://github.com/performous/restinio/blob/deeaf083d95cb80a1746048d4f9851050cb95b65/dev/restinio/path2regex/path2regex.hpp#L622-L648 There is no closing } for switch statement.

After fixing those errors I got:

./restinio/third_party/optional-lite/optional.hpp:803:9: error: no matching 'operator new' function for non-allocating placement new expression; include <new>
        ::new( value_ptr() ) value_type( std::forward<Args>(args)... );
        ^~
./restinio/third_party/optional-lite/optional.hpp:797:9: note: in instantiation of function template specialization 'nonstd::optional_lite::detail::storage_t<const std::basic_string<char>>::emplace<const std::basic_string<char> &>' requested here
        emplace( std::forward<Args>(args)... );

in C++14 mode.

Lord-Kamina commented 1 year ago

Huh... this seems like some kind of weird merge error.

How the eff did it compile for me, then?

Can you reopen the PR so I can fix it properly?

Edit: where is that optional-lite error coming from?