diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 13:45:24 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-11 13:45:24 +0200 |
commit | 6eb2f644057f371841fe25330a57ee185f91c7af (patch) | |
tree | 7b4d02586339d1a7f82104b4473d9ac243b3abf9 /src/construct/block_quote.rs | |
parent | 2d35cbfceace81a217cd0fbdae7a8777c7a6465e (diff) | |
download | markdown-rs-6eb2f644057f371841fe25330a57ee185f91c7af.tar.gz markdown-rs-6eb2f644057f371841fe25330a57ee185f91c7af.tar.bz2 markdown-rs-6eb2f644057f371841fe25330a57ee185f91c7af.zip |
Refactor to move some code to `state.rs`
Diffstat (limited to 'src/construct/block_quote.rs')
-rw-r--r-- | src/construct/block_quote.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/construct/block_quote.rs b/src/construct/block_quote.rs index bbfad5b..7b8ce82 100644 --- a/src/construct/block_quote.rs +++ b/src/construct/block_quote.rs @@ -35,8 +35,9 @@ use crate::constant::TAB_SIZE; use crate::construct::partial_space_or_tab::space_or_tab_min_max; +use crate::state::{Name, State}; use crate::token::Token; -use crate::tokenizer::{State, StateName, Tokenizer}; +use crate::tokenizer::Tokenizer; /// Start of block quote. /// @@ -55,7 +56,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { usize::MAX }, ); - tokenizer.attempt(name, State::Next(StateName::BlockQuoteBefore), State::Nok) + tokenizer.attempt(name, State::Next(Name::BlockQuoteBefore), State::Nok) } else { State::Nok } @@ -71,9 +72,9 @@ pub fn before(tokenizer: &mut Tokenizer) -> State { match tokenizer.current { Some(b'>') => { tokenizer.enter(Token::BlockQuote); - State::Retry(StateName::BlockQuoteContBefore) + State::Retry(Name::BlockQuoteContBefore) } - _ => State::Retry(StateName::BlockQuoteContBefore), + _ => State::Retry(Name::BlockQuoteContBefore), } } @@ -94,11 +95,7 @@ pub fn cont_start(tokenizer: &mut Tokenizer) -> State { usize::MAX }, ); - tokenizer.attempt( - name, - State::Next(StateName::BlockQuoteContBefore), - State::Nok, - ) + tokenizer.attempt(name, State::Next(Name::BlockQuoteContBefore), State::Nok) } /// After whitespace, before `>`. @@ -115,7 +112,7 @@ pub fn cont_before(tokenizer: &mut Tokenizer) -> State { tokenizer.enter(Token::BlockQuoteMarker); tokenizer.consume(); tokenizer.exit(Token::BlockQuoteMarker); - State::Next(StateName::BlockQuoteContAfter) + State::Next(Name::BlockQuoteContAfter) } _ => State::Nok, } |