diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-10 10:54:43 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-10 10:54:43 +0200 |
commit | 3a90a49518bbc53876d3f46d8763b2fe0f03d789 (patch) | |
tree | eecaaf9586cf8632b3b6fe22794dae1f492849f5 /src/construct/label_end.rs | |
parent | 8162222295d71ea7fd9270c7b3b9497b91db3f1f (diff) | |
download | markdown-rs-3a90a49518bbc53876d3f46d8763b2fe0f03d789.tar.gz markdown-rs-3a90a49518bbc53876d3f46d8763b2fe0f03d789.tar.bz2 markdown-rs-3a90a49518bbc53876d3f46d8763b2fe0f03d789.zip |
Add `State::Retry`
Diffstat (limited to '')
-rw-r--r-- | src/construct/label_end.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index 0404b6e..3337cec 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -193,7 +193,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { // Mark as balanced if the info is inactive. if label_start.inactive { - return nok(tokenizer); + return State::Retry(StateName::LabelEndNok); } tokenizer.enter(Token::LabelEnd); @@ -257,11 +257,11 @@ pub fn after(tokenizer: &mut Tokenizer) -> State { }), ), // Shortcut (`[asd]`) reference? - _ => { - // To do: use state names? - let func = if defined { ok } else { nok }; - func(tokenizer) - } + _ => State::Retry(if defined { + StateName::LabelEndOk + } else { + StateName::LabelEndNok + }), } } @@ -391,7 +391,7 @@ pub fn resource_before(tokenizer: &mut Tokenizer) -> State { /// ``` pub fn resource_open(tokenizer: &mut Tokenizer) -> State { if let Some(b')') = tokenizer.current { - resource_end(tokenizer) + State::Retry(StateName::LabelEndResourceEnd) } else { tokenizer.tokenize_state.token_1 = Token::ResourceDestination; tokenizer.tokenize_state.token_2 = Token::ResourceDestinationLiteral; @@ -458,7 +458,7 @@ pub fn resource_between(tokenizer: &mut Tokenizer) -> State { State::Nok, ) } - _ => resource_end(tokenizer), + _ => State::Retry(StateName::LabelEndResourceEnd), } } |