Nicholas Nethercote
df56c50cee
Make TokenType::from_u32 foolproof.
...
Currently it relies on having the right integer for every variant, and
if you add a variant you need to adjust the integers for all subsequent
variants, which is a pain.
This commit introduces a match guard formulation that takes advantage of
the enum-to-integer conversion to avoid specifying the integer for each
variant. And it does this via a macro to avoid lots of boilerplate.
2024-12-19 16:05:41 +11:00
..
2024-12-18 13:38:53 +11:00
2024-12-18 22:56:53 +08:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 22:56:53 +08:00
2024-12-16 19:08:19 +01:00
2024-12-18 13:38:53 +11:00
2024-12-18 22:57:23 +00:00
2024-12-19 16:05:41 +11:00
2024-12-18 13:38:53 +11:00
2024-12-16 19:08:19 +01:00
2024-12-18 02:56:38 +00:00
2024-12-18 09:23:22 +00:00
2024-12-18 19:16:15 +00:00
2024-12-18 22:56:56 +08:00
2024-12-18 02:56:38 +00:00
2024-12-19 16:05:41 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 22:56:52 +08:00
2024-12-18 13:38:53 +11:00
2024-12-18 22:56:54 +08:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 19:16:15 +00:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 02:56:38 +00:00
2024-12-18 22:56:54 +08:00
2024-12-18 22:56:55 +08:00
2024-12-18 22:57:23 +00:00
2024-12-18 20:43:55 +08:00
2024-12-18 13:38:53 +11:00
2024-12-19 16:05:41 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-13 16:36:38 +00:00
2024-12-18 13:38:53 +11:00
2024-12-18 02:56:38 +00:00
2024-12-18 22:56:56 +08:00
2024-12-18 13:38:53 +11:00
2024-12-18 20:21:03 +11:00
2024-12-18 13:38:53 +11:00
2024-12-18 02:56:38 +00:00
2024-12-18 02:56:38 +00:00
2024-12-18 13:38:53 +11:00
2024-12-18 13:38:53 +11:00
2024-12-17 14:33:10 -08:00
2024-12-14 03:45:35 +00:00