(first: u8)
| 159 | /* UTF-8 byte length from lead byte; supports non-ASCII identifiers. */ |
| 160 | #[inline] |
| 161 | pub fn utf8_char_len(first: u8) -> usize { |
| 162 | match first { |
| 163 | 0x00..=0x7F => 1, |
| 164 | 0xC0..=0xDF => 2, |
| 165 | 0xE0..=0xEF => 3, |
| 166 | _ => 4, |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | /* Reverse lookup for diagnostics: TokenType -> quoted display name. */ |
| 171 | pub const fn token_to_str(kind: &TokenType) -> &'static str { |