diff options
author | 2022-08-11 17:26:17 +0200 | |
---|---|---|
committer | 2022-08-11 17:26:17 +0200 | |
commit | 0d9c4611922535533746d1a86f10ef4e701c950e (patch) | |
tree | dd776161db75ba264b67830635b736ca5dd5c314 /src/construct/thematic_break.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 '')
-rw-r--r-- | src/construct/thematic_break.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/construct/thematic_break.rs b/src/construct/thematic_break.rs index 5969e77..f4d008d 100644 --- a/src/construct/thematic_break.rs +++ b/src/construct/thematic_break.rs @@ -63,7 +63,8 @@ use crate::tokenizer::Tokenizer; pub fn start(tokenizer: &mut Tokenizer) -> State { if tokenizer.parse_state.constructs.thematic_break { tokenizer.enter(Name::ThematicBreak); - let name = space_or_tab_min_max( + tokenizer.attempt(State::Next(StateName::ThematicBreakBefore), State::Nok); + State::Retry(space_or_tab_min_max( tokenizer, 0, if tokenizer.parse_state.constructs.code_indented { @@ -71,13 +72,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { } else { usize::MAX }, - ); - - tokenizer.attempt( - name, - State::Next(StateName::ThematicBreakBefore), - State::Nok, - ) + )) } else { State::Nok } @@ -146,12 +141,11 @@ pub fn sequence(tokenizer: &mut Tokenizer) -> State { } _ => { tokenizer.exit(Name::ThematicBreakSequence); - let name = space_or_tab(tokenizer); tokenizer.attempt( - name, State::Next(StateName::ThematicBreakAtBreak), State::Next(StateName::ThematicBreakAtBreak), - ) + ); + State::Retry(space_or_tab(tokenizer)) } } } |