From 0d9c4611922535533746d1a86f10ef4e701c950e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 11 Aug 2022 17:26:17 +0200 Subject: Refactor attempts to remove unneeded state name --- src/construct/block_quote.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/construct/block_quote.rs') diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs index f2b0179..1a32f7d 100644 --- a/src/construct/block_quote.rs +++ b/src/construct/block_quote.rs @@ -47,7 +47,8 @@ use crate::tokenizer::Tokenizer; /// ``` pub fn start(tokenizer: &mut Tokenizer) -> State { if tokenizer.parse_state.constructs.block_quote { - let name = space_or_tab_min_max( + tokenizer.attempt(State::Next(StateName::BlockQuoteBefore), State::Nok); + State::Retry(space_or_tab_min_max( tokenizer, 0, if tokenizer.parse_state.constructs.code_indented { @@ -55,8 +56,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { } else { usize::MAX }, - ); - tokenizer.attempt(name, State::Next(StateName::BlockQuoteBefore), State::Nok) + )) } else { State::Nok } @@ -86,7 +86,8 @@ pub fn before(tokenizer: &mut Tokenizer) -> State { /// ^ /// ``` pub fn cont_start(tokenizer: &mut Tokenizer) -> State { - let name = space_or_tab_min_max( + tokenizer.attempt(State::Next(StateName::BlockQuoteContBefore), State::Nok); + State::Retry(space_or_tab_min_max( tokenizer, 0, if tokenizer.parse_state.constructs.code_indented { @@ -94,12 +95,7 @@ pub fn cont_start(tokenizer: &mut Tokenizer) -> State { } else { usize::MAX }, - ); - tokenizer.attempt( - name, - State::Next(StateName::BlockQuoteContBefore), - State::Nok, - ) + )) } /// After whitespace, before `>`. -- cgit