aboutsummaryrefslogtreecommitdiffstats
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 11:30:49 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 11:30:49 +0200
commitb4aa82f0f1ea3143ab5f221b2c5f564158605c84 (patch)
tree526f25680d30ad615ee868366545895059384f22 /src/tokenizer.rs
parent08b9e5b5c3eddbc948cc9952783c1925b90ed9e0 (diff)
downloadmarkdown-rs-b4aa82f0f1ea3143ab5f221b2c5f564158605c84.tar.gz
markdown-rs-b4aa82f0f1ea3143ab5f221b2c5f564158605c84.tar.bz2
markdown-rs-b4aa82f0f1ea3143ab5f221b2c5f564158605c84.zip
Fix token that should be void
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs11
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!(