From 0be7464edbd0fae379eff1e18d64bd2099651040 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 23 May 2023 16:31:21 +0200 Subject: Refactor some code --- src/construct/label_end.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/construct/label_end.rs') diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index f47920c..1c5e0bd 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -529,7 +529,7 @@ pub fn resource_title_after(tokenizer: &mut Tokenizer) -> State { if matches!(tokenizer.current, Some(b'\t' | b'\n' | b' ')) { tokenizer.attempt( - State::Next(StateName::LabelEndResourceBetween), + State::Next(StateName::LabelEndResourceEnd), State::Next(StateName::LabelEndResourceEnd), ); State::Retry(space_or_tab_eol(tokenizer)) @@ -571,7 +571,7 @@ pub fn reference_full(tokenizer: &mut Tokenizer) -> State { tokenizer.tokenize_state.token_3 = Name::ReferenceString; tokenizer.attempt( State::Next(StateName::LabelEndReferenceFullAfter), - State::Nok, + State::Next(StateName::LabelEndReferenceFullMissing) ); State::Retry(StateName::LabelStart) } @@ -615,6 +615,19 @@ pub fn reference_full_after(tokenizer: &mut Tokenizer) -> State { } } +/// In reference (full) that was missing. +/// +/// ```markdown +/// > | [a][b d +/// ^ +/// ``` +pub fn reference_full_missing(tokenizer: &mut Tokenizer) -> State { + tokenizer.tokenize_state.token_1 = Name::Data; + tokenizer.tokenize_state.token_2 = Name::Data; + tokenizer.tokenize_state.token_3 = Name::Data; + State::Nok +} + /// In reference (collapsed), at `[`. /// /// > 👉 **Note**: we only get here if the label is defined. -- cgit