diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 17:26:17 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 17:26:17 +0200 |
commit | 0d9c4611922535533746d1a86f10ef4e701c950e (patch) | |
tree | dd776161db75ba264b67830635b736ca5dd5c314 /src/construct/block_quote.rs | |
parent | 90969231bfcdfcd09bae646abba17d832b633376 (diff) | |
download | markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.tar.gz markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.tar.bz2 markdown-rs-0d9c4611922535533746d1a86f10ef4e701c950e.zip |
Refactor attempts to remove unneeded state name
Diffstat (limited to 'src/construct/block_quote.rs')
-rw-r--r-- | src/construct/block_quote.rs | 16 |
1 files changed, 6 insertions, 10 deletions
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 `>`. |