From a4dc19af6e82757af87c6658d7b1771a9694b83d Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 11 Aug 2022 16:24:56 +0200 Subject: Remove unneeded `balance` info on label starts --- src/tokenizer.rs | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/tokenizer.rs') diff --git a/src/tokenizer.rs b/src/tokenizer.rs index b2d0751..8ff19c3 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -18,22 +18,6 @@ use crate::resolve::{call as call_resolve, Name as ResolveName}; use crate::state::{call, Name as StateName, State}; use crate::util::edit_map::EditMap; -/// Media we found. -#[derive(Debug)] -pub struct Media { - /// Indices of where the media’s label start starts and ends in `events`. - pub start: (usize, usize), - /// Indices of where the media’s label end starts and ends in `events`. - pub end: (usize, usize), -} - -/// Supported containers. -#[derive(Debug, PartialEq)] -pub enum Container { - BlockQuote, - ListItem, -} - /// Info used to tokenize the current container. /// /// This info is shared between the initial construct and its continuation. @@ -61,17 +45,32 @@ enum ByteAction { Ignore, } +/// Supported containers. +#[derive(Debug, PartialEq)] +pub enum Container { + BlockQuote, + ListItem, +} + /// Loose label starts we found. #[derive(Debug)] pub struct LabelStart { /// Indices of where the label starts and ends in `events`. pub start: (usize, usize), - /// A boolean used internally to figure out if a label start link can’t be - /// used (because links in links are incorrect). + /// A boolean used internally to figure out if a (link) label start link + /// can’t be used anymore (because it would contain another link). + /// That link start is still looking for a balanced closing bracket though, + /// so we can’t remove it just yet. pub inactive: bool, - /// A boolean used internally to figure out if a label is balanced: they’re - /// not media, it’s just balanced braces. - pub balanced: bool, +} + +/// Media we found. +#[derive(Debug)] +pub struct Media { + /// Indices of where the media’s label start starts and ends in `events`. + pub start: (usize, usize), + /// Indices of where the media’s label end starts and ends in `events`. + pub end: (usize, usize), } /// Different kinds of attempts. -- cgit