#Code review for a basic lexer
12 messages · Page 1 of 1 (latest)
about is_digit and is_alpha: they shouldn’t be associated methods of Scanner since they’re not really related to the type?
So just put them as small functions at the bottom
Also &char shouldn’t ever exist as a type
always use char instead
char is always smaller and faster to work with
Same goes for write_char_to_str and str_to_token
Also write_char_to_str can be replaced with just ```rs
string.push(c);
there’s a dedicated method for it
A UTF-8–encoded, growable string.
Also EOF should be in PascalCase like the rest of the variants: Eof
You can just do .copied() to go Option<&char> → Option<char> btw
