skvadrik / re2c

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

Support new Zig's labeled switch/continue #492

Open Ev1lT3rm1nal opened 2 days ago

Ev1lT3rm1nal commented 2 days ago

So, issue https://github.com/ziglang/zig/pull/21257 was closed, adding support for new syntax for labeled switch/continue statements, which improves performance (somewhat like computed gotos in C). It would be great if re2c added this feature too, although it is currently in Zig's master branch.

skvadrik commented 2 days ago

I added labelled loops for Zig in https://github.com/skvadrik/re2c/commit/72a7d1b3039fe35ad7797fa7dda5042d1323314f (it hasn't been merged into master yet, but it will be merged soon). This feature is important for correctness, as it would be quite easy to forget about the hidden loop generated by re2c when enclosing it in an outer user-defined loop. It is possible to suppress label generation by setting re2c:label:yyloop = ""; (e.g. if the Zig toolchain in use doesn't have this feature yet).

Ev1lT3rm1nal commented 1 day ago

This looks awesome! Thank you for updating the library for the upcoming changes.