diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 16:24:56 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 16:24:56 +0200 |
commit | a4dc19af6e82757af87c6658d7b1771a9694b83d (patch) | |
tree | 3c0050f0a46ffc3b0ecb54516e4c7a5447efeed4 /src/tokenizer.rs | |
parent | 3048b7aca0690691d25cb8409d543b2377e065e1 (diff) | |
download | markdown-rs-a4dc19af6e82757af87c6658d7b1771a9694b83d.tar.gz markdown-rs-a4dc19af6e82757af87c6658d7b1771a9694b83d.tar.bz2 markdown-rs-a4dc19af6e82757af87c6658d7b1771a9694b83d.zip |
Remove unneeded `balance` info on label starts
Diffstat (limited to '')
-rw-r--r-- | src/tokenizer.rs | 41 |
1 files changed, 20 insertions, 21 deletions
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. |