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
1 changed files with 1 additions and 1 deletions
|
@ -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),
|
"LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None),
|
||||||
"QUESTION" => token::Question,
|
"QUESTION" => token::Question,
|
||||||
"SHEBANG" => token::Shebang(Name(0)),
|
"SHEBANG" => token::Shebang(Name(0)),
|
||||||
_ => continue,
|
_ => panic!("Bad token str `{}`", val),
|
||||||
};
|
};
|
||||||
|
|
||||||
res.insert(num.to_string(), tok);
|
res.insert(num.to_string(), tok);
|
||||||
|
|
Loading…
Add table
Reference in a new issue