PCRE2Project / pcre2

PCRE2 development is now based here.
Other
917 stars 191 forks source link

Various code improvements for eclasses #546

Closed zherczeg closed 2 weeks ago

zherczeg commented 3 weeks ago

I think the new code is quite nice and works nicely. I did some code reworks to improve the operations. There is no byte code optimizations. @NWilson please check.

zherczeg commented 3 weeks ago

I don't want to work on any class optimizations at this point. The task is yours as we discussed. I will share my ideas on the topic, but it is your decision how to use them. This patch tries to improve existing code, nothing more.

NWilson commented 3 weeks ago

Thank you Zoltan! I'm very grateful for your contributions, you are welcome to work on the code of course. I only wanted to make sure we don't duplicate work by mistake.

zherczeg commented 2 weeks ago

I did the requested changes except one. I could not find a nice way to pass around the class end without many defines. Maybe we can do that in a follow up patch if we find some nice solution.

zherczeg commented 2 weeks ago

I found a very different way to do the requested debug check. I have added a macro, CLASS_END_CASES, which has a list of the allowed class token endings. With this macro, it is not possible that one loop handles a case, and the other does not:

/* Checks the allowed tokens at the end of a class structure in debug mode.
When a new token is processed by one loop, and not the other, and the token is
a) equals to one of the cases here: the compiler will complain
   about a duplicated case value.
b) equals to none of the cases here: the loop without the handler will stop
   with an assertion failure. */