Instead of parsing things as keywords without knowing whether the token needed is a keyword or not, let's instead have a parse_keyword(keyword: &str) method that calls as a parse_ident() method and then checks if the return identifier matches the expected keyword.
This turned out to be harder than it looked. I'll probably have to create a small toy parser to see if I can figure out the right pattern before implementing it for real.
Instead of parsing things as keywords without knowing whether the token needed is a keyword or not, let's instead have a
parse_keyword(keyword: &str)
method that calls as aparse_ident()
method and then checks if the return identifier matches the expected keyword.