Panic if the grammar verifier sees a token it doesn't recognize

To prevent the reference grammar from getting out of sync with the real
grammar, panic if RustLexer.tokens contains an unknown token in a
similar way that verify.rs panics if it encounters an unknown binary
operation token.
This commit is contained in:
Carol Nichols 2015-05-05 19:32:26 -04:00
parent 1ca9ed61d6
commit 9c7d5ae57c

View File

@ -111,7 +111,7 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
"LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None),
"QUESTION" => token::Question,
"SHEBANG" => token::Shebang(Name(0)),
_ => continue,
_ => panic!("Bad token str `{}`", val),
};
res.insert(num.to_string(), tok);