From b4aa82f0f1ea3143ab5f221b2c5f564158605c84 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 18 Jul 2022 11:30:49 +0200 Subject: Fix token that should be void --- src/tokenizer.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/tokenizer.rs') 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!( -- cgit