Skip to content

Commit 9c7d5ae

Browse files
committed
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.
1 parent 1ca9ed6 commit 9c7d5ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/grammar/verify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
111111
"LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None),
112112
"QUESTION" => token::Question,
113113
"SHEBANG" => token::Shebang(Name(0)),
114-
_ => continue,
114+
_ => panic!("Bad token str `{}`", val),
115115
};
116116

117117
res.insert(num.to_string(), tok);

0 commit comments

Comments
 (0)