diff options
Diffstat (limited to '')
-rw-r--r-- | src/tokenizer.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 10c877f..9b39e28 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -12,7 +12,7 @@ //! [`check`]: Tokenizer::check use crate::parser::ParseState; -use crate::token::Token; +use crate::token::{Token, VOID_TOKENS}; use std::collections::HashMap; /// Embedded content type. @@ -385,6 +385,15 @@ impl<'a> Tokenizer<'a> { "expected non-empty token" ); + if VOID_TOKENS.iter().any(|d| d == &token_type) { + assert!( + current_token == previous.token_type, + "expected token to be void (`{:?}`), instead of including `{:?}`", + current_token, + previous.token_type + ); + } + // A bit weird, but if we exit right after a line ending, we *don’t* want to consider // potential skips. if matches!( |