skvadrik / re2c

Lexer generator for C, C++, Go and Rust.
https://re2c.org
Other
1.07k stars 169 forks source link

no goto #384

Closed xR3b0rn closed 2 years ago

xR3b0rn commented 2 years ago

Removing goto from the code template, would make it possible to use the generated code in C++ constexpr-functions. I know the gotos are fundamental part of the concept of this library, however, it could be worth the effort in order to catch some C++ programmers which are looking for a compile-time regex library.

skvadrik commented 2 years ago

Hi @xR3b0rn , we are already working on a --loop-switch option that would generate code without goto (the primary goal is to add a Rust backend, but the option would also work on C/C++ and Go). See https://github.com/skvadrik/re2c/issues/372 for discussion of the --loop-switch option. Early results are available on the rust branch.

skvadrik commented 2 years ago

Closing, as --loop-switch is fully implemented and will soon be released.

xR3b0rn commented 2 years ago

Can you link the commit?

skvadrik commented 2 years ago

It's a bit difficult because the implementation for different features appeared in parts:

Generally, see https://github.com/skvadrik/re2c/search?q=loop%2Fswitch&type=commits

xR3b0rn commented 2 years ago

When you will integrate this feature in production?

skvadrik commented 2 years ago

It is already released in version 3.0: release notes and https://github.com/skvadrik/re2c/releases/tag/3.0