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:
parent
1ca9ed61d6
commit
9c7d5ae57c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user