hanickadot / compile-time-regular-expressions

Compile Time Regular Expression in C++
https://twitter.com/hankadusikova
Apache License 2.0
3.32k stars 183 forks source link

Bug: `lazy_repeat` drops `utf8_iterator` when matching a `char8_t` string #285

Closed vector-of-bool closed 1 year ago

vector-of-bool commented 1 year ago

The following example reproduces the error:

// Compiles: 
match<"x+">(u8"x");
// Fails:
match<"x+?">(u8"x");

In the lazy_repeat evaluator, a nested call to evaluate() looks like this:

evaluate(begin, inner_result.get_end_position(), last, ...);

The type of last/EndIterator is utf8_iterator::sentinel, but inner_result.get_end_position() returns a const char8_t*, and these types are not equality-comparable.

Possibly needs a static_cast<Itertaor> around the call to get_end_position? I'm not sure if this would have some other unintended effects, or if there are other points in the code that will need to be similarly modified.

hanickadot commented 1 year ago

It should be fixed now :)

vector-of-bool commented 1 year ago

Excellent! Thank you for the quick fix!