3 ms·
One cool pattern for tokens is a T! macro: macro_rules! T { (+) => { Token::Add }, (-) => { Token::Sub }, // ... } This is reall
by ibraheemdev 5y ago
One cool pattern for tokens is a T! macro:
macro_rules! T {
(+) => { Token::Add },
(-) => { Token::Sub },
// ...
}
This is really nice because it lets you match against tokens with `T![+]` instead of `Token::Add`.