I've found that the logos crate is really nice for writing lexers in rust
https://docs.rs/logos/0.14.2/logos/